Bonjour,
Je me bats depuis 2 heure à faire un truc qui doit etre super simple pour vous.
J'ai ces chaines de caratere
J'aimerais remplace uniquement cecihttp://localhost/theshop/category.php?id_category=1
http://localhost/theshop/category.php?id_category=2
http://localhost/theshop/category.php?id_category=3
http://localhost/theshop/category.php?id_category=4
http://localhost/theshop/category.php?id_category=5
http://localhost/theshop/category.php?id_category=6
par
Alors j'ai fair comme ceci
Sachant que $categorie->getLink() affiche alternativement (boucle) les URL ci-dessus.
Code PHP : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 echo preg_replace("/\category.php?id_category=1\b/i","toto",$categorie->getLink());
Evidemment ca ne marche pas, je ne vois pas "toto". Je pense que c'est à cause du . et du ?
N'es-ce pas? Mais comment faire pour les échaper. J'ai essayé avec le backsalsh \, mais sans succès.
Une petite aide m'aiderait. Merci
Partager