pb de codage en php(résolu)
Dernière réponse : dans Programmation
Bonjour
je fais une migration de ASP vers php, et je rencontre un pb avec mon code en php.si qqn peut m'aider svp!!
je vous donne le code d'origine en ASP et le code correspondant en php que j'ai fait.
Merci d'avance
code en ASP
<%
// on veut tester si un fichier existe
// définition du chemein absolu du fichier
Set fso = CreateObject("Scripting.FileSystemObject")
rep= Server.MapPath("\Entrenoo\upload_MPM\ACompleter\")
set fo=fso.GetFolder(rep&"\")
for each x in fo.SubFolders
For each fich in x.Files
if month(date())>month(fich.datecreated)+2 then
else if month(date())=month(fich.datecreated)+2 then
if day(date())>day(fich.datecreated) then
fich.delete
end if
end if
end if
Next
next
rep= Server.MapPath("\Entrenoo\upload_MPM\Completés\")
set fo=fso.GetFolder(rep&"\")
for each x in fo.SubFolders
For each fich in x.Files
if month(date())>month(fich.datecreated)+2 then
else if month(date())=month(fich.datecreated)+2 then
if day(date())>day(fich.datecreated) then
fich.delete
end if
end if
end if
Next
next
%>
code en php
<?
$rep="\Entrenoo\upload_MPM\ACompleter\";
$dir=opendir($rep);
while($R=readdir($dir)){
while($f=readdir($R)){
if(is_file($R.$f){
$format='m';
if ($mois=date($format))> date("m",filectime($R.$f))+2 {
else if ($mois=date($format))=date("m",filectime($R.$f))+2{
$format='d';
if ($jour=date($format))> date("d",filectime($R.$f)){
unlink($f);
}
}
}
}
}
}
$rep="\Entrenoo\upload_MPM\Completés\";
$dir=opendir($rep);
while($R=readdir($dir)){
while($f=readdir($R)){
if(is_file($R.$f){
$format='m';
if ($mois=date($format))> date("m",filectime($R.$f))+2 {
else if ($mois=date($format))=date("m",filectime($R.$f))+2{
$format='d';
if ($jour=date($format))> date("d",filectime($R.$f)){
unlink($f);
}
}
}
}
}
}
?>
je fais une migration de ASP vers php, et je rencontre un pb avec mon code en php.si qqn peut m'aider svp!!
je vous donne le code d'origine en ASP et le code correspondant en php que j'ai fait.
Merci d'avance
code en ASP
<%
// on veut tester si un fichier existe
// définition du chemein absolu du fichier
Set fso = CreateObject("Scripting.FileSystemObject")
rep= Server.MapPath("\Entrenoo\upload_MPM\ACompleter\")
set fo=fso.GetFolder(rep&"\")
for each x in fo.SubFolders
For each fich in x.Files
if month(date())>month(fich.datecreated)+2 then
else if month(date())=month(fich.datecreated)+2 then
if day(date())>day(fich.datecreated) then
fich.delete
end if
end if
end if
Next
next
rep= Server.MapPath("\Entrenoo\upload_MPM\Completés\")
set fo=fso.GetFolder(rep&"\")
for each x in fo.SubFolders
For each fich in x.Files
if month(date())>month(fich.datecreated)+2 then
else if month(date())=month(fich.datecreated)+2 then
if day(date())>day(fich.datecreated) then
fich.delete
end if
end if
end if
Next
next
%>
code en php
<?
$rep="\Entrenoo\upload_MPM\ACompleter\";
$dir=opendir($rep);
while($R=readdir($dir)){
while($f=readdir($R)){
if(is_file($R.$f){
$format='m';
if ($mois=date($format))> date("m",filectime($R.$f))+2 {
else if ($mois=date($format))=date("m",filectime($R.$f))+2{
$format='d';
if ($jour=date($format))> date("d",filectime($R.$f)){
unlink($f);
}
}
}
}
}
}
$rep="\Entrenoo\upload_MPM\Completés\";
$dir=opendir($rep);
while($R=readdir($dir)){
while($f=readdir($R)){
if(is_file($R.$f){
$format='m';
if ($mois=date($format))> date("m",filectime($R.$f))+2 {
else if ($mois=date($format))=date("m",filectime($R.$f))+2{
$format='d';
if ($jour=date($format))> date("d",filectime($R.$f)){
unlink($f);
}
}
}
}
}
}
?>
Autres pages sur : codage php resolu
Lassé par la pub ? Créez un compte
Lassé par la pub ? Créez un compte
sur ton premier post