Récuperer l'URL en cours avec $_SERVER

cs_attentio Messages postés 167 Date d'inscription mardi 20 janvier 2004 Statut Membre Dernière intervention 24 mai 2010 - 17 oct. 2007 à 15:53
malalam Messages postés 10839 Date d'inscription lundi 24 février 2003 Statut Membre Dernière intervention 2 mars 2010 - 17 oct. 2007 à 20:16
Bonjour,
 je voudrais recuperer l'url actuelle complete
j'ai fait ceci :

<?
if (!empty($_SERVER['QUERY_STRING'])) { $page_actuelle = $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']; }
else { $page_actuelle = $_SERVER['PHP_SELF']; }
print_r(''. $page_actuelle.'');
?>


mais il m'affiche monsite/version2/index.php?id=36
et je voudrais qu'il affiche  seulement index.php?id=36


comment faire ?
merci de votre aide

1 réponse

malalam Messages postés 10839 Date d'inscription lundi 24 février 2003 Statut Membre Dernière intervention 2 mars 2010 25
17 oct. 2007 à 20:16
Hello,

echo basename($_SERVER ('PHP_SELF'));
echo $_SERVER['SCRIPT_NAME'];
echo basename(__FILE__);
il y a un tas de possibilités :-)
0
Rejoignez-nous