Bonjour,
Je travaille actuellement sur un site à base Wordpress.
Un petit problème se présente a moi, je cherche a récupéré le href d'un string.
C'est à dire que je récupère via la fonction get_next_posts_link(''); un string du type '<a href="http://localhost:8888/Wordpress/page/2/" ></a>' et je cherche a récupérer 'http://localhost:8888/Wordpress/page/2/'.
J'ai donc cherché à utiliser les RegEx via la fonction preg_replace().
J'ai tenté ceci mais sans résultat :
Le premier echo fonctionne bien mais le deuxième n'affiche rien. J'ai loupé un truc ?
Modifié par iFef (05 Aug 2011 - 00:05)
Je travaille actuellement sur un site à base Wordpress.
Un petit problème se présente a moi, je cherche a récupéré le href d'un string.
C'est à dire que je récupère via la fonction get_next_posts_link(''); un string du type '<a href="http://localhost:8888/Wordpress/page/2/" ></a>' et je cherche a récupérer 'http://localhost:8888/Wordpress/page/2/'.
J'ai donc cherché à utiliser les RegEx via la fonction preg_replace().
J'ai tenté ceci mais sans résultat :
$next=get_next_posts_link('');
echo $next;
$next=preg_replace('/<a href="([^]+)" ></a>/gi','$1',$next);
echo $next;
Le premier echo fonctionne bien mais le deuxième n'affiche rien. J'ai loupé un truc ?
Modifié par iFef (05 Aug 2011 - 00:05)