code qui ne marche pas sur windows mais marche sur linux

Mammouth du PHP | 568 Messages

22 sept. 2011, 17:11

haaa javais pas remarqué que le vhost disparait ... bizarrre

dans mon code la variable du chemin est

$pathImg ="D:\inetpub\vhosts\brodepromochic.com\httpdocs\\";

mais une fois exécuté dans:

$delete_file=unlink(''.$pathImg.'photos\img_prod\\'.$row["image"].'');

la partie vhost disparait ...


avez-vous une idée de la cause?
Enlève moi ces double simple quote et ré-affiche le path.

EDIT: tu fais un
echo ''.$pathImg.'photos\img_prod\\'.$row["image"].'';
puis
echo $pathImg.'photos\img_prod\\'.$row["image"];

Eléphant du PHP | 331 Messages

22 sept. 2011, 17:19

echo ''.$pathImg.'photos\img_prod\\'.$row["image"].'';
donne

D:\inetpubhosts\brodepromochic.com\httpdocs\photos\img_prod\85.JPG
echo $pathImg.'photos\img_prod\\'.$row["image"];
donne

D:\inetpubhosts\brodepromochic.com\httpdocs\photos\img_prod\85.JPG

jai fais un test en écrivant le chemin dans la fonction comme ceci
$delete_file=unlink('D:\inetpub\vhosts\brodepromochic.com\httpdocs\photos\img_prod\\'.$row["image"].''); 
plutot que comme ceci
$delete_file=unlink(''.$pathImg.'photos\img_prod\\'.$row["image"].'');
sa fonctionne mais cest pas pratique

ViPHP
ViPHP | 2577 Messages

22 sept. 2011, 17:26

Regarde ce que contient la variable $pathImg, vhost ne disparait pas de manière magique.
A mon avis tu l'initialises 2 fois.

Eléphant du PHP | 331 Messages

22 sept. 2011, 17:37

si je fais
	$pathImg ="D:\inetpub\vhosts\brodepromochic.com\httpdocs\\";
	$delete_file=unlink(''.$pathImg.'photos\img_prod\\'.$row["image"].''); 
et que je retire la variable pathimg du fichier config.php bien sa bug

tk merci pour votre aide

pour ce site je mettrai le chemin dans les variables et la prochaine fois qun client me demandera d'héberger chez progitech de chicoutimi je dirai non merci