Steve TENZA
Web développeur
Facebook Me contacter Cookie
Télécharger
Noter:
5/5 (1)
Ajouté/Modifié le 2023-10-28
Visionné 6287 fois

Lister toutes les variables $_SERVER PHP

Description

Explorez toutes les variables $_SERVER en PHP grâce à ce code simple et efficace qui vous permettra de répertorier toutes ces variables et de découvrir leur contenu. Pour cela, nous utilisons la fonction var_dump(), propre à PHP, qui affiche de manière détaillée les informations contenues dans une variable.

var_dump($_SERVER);

foreach($_SERVER as $nom => $valeur){
//affichage simple (nom + valeur)
echo $nom.' = '.$valeur.'<br/>';
}

foreach($_SERVER as $nom => $valeur){
//affichage stylisé avec la variable complète
echo '$_SERVER[\''.$nom.'\'] = '.$valeur.'<br/>';
}


Le rendu sur Windows : localhost

array (size=36)
'HTTP_HOST' => string 'localhost' (length=9)
'HTTP_USER_AGENT' => string 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0' (length=72)
'HTTP_ACCEPT' => string 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' (length=63)
'HTTP_ACCEPT_LANGUAGE' => string 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3' (length=35)
'HTTP_ACCEPT_ENCODING' => string 'gzip, deflate' (length=13)
'HTTP_REFERER' => string 'http://localhost/' (length=17)
'HTTP_COOKIE' => string 'PHPSESSID=gec0c0g0r1m3ui6v2dcuthmud4' (length=36)
'HTTP_CONNECTION' => string 'keep-alive' (length=10)
'HTTP_PRAGMA' => string 'no-cache' (length=8)
'HTTP_CACHE_CONTROL' => string 'max-age=0' (length=9)
'PATH' => string 'C:Program Files (x86)NVIDIA CorporationPhysXCommon;C:ProgramDataOracleJavajavapath;C:Program FilesBroadcomBroadcom 802.11 Network AdapterDriver;;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:Program Files (x86)Microsoft SQL Server90Toolsbinn;' (length=316)
'SystemRoot' => string 'C:Windows' (length=10)
'COMSPEC' => string 'C:Windowssystem32cmd.exe' (length=27)
'PATHEXT' => string '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC' (length=53)
'WINDIR' => string 'C:Windows' (length=10)
'SERVER_SIGNATURE' => string '<address>Apache/2.4.9 (Win32) PHP/5.5.12 Server at localhost Port 80</address>' (length=79)
'SERVER_SOFTWARE' => string 'Apache/2.4.9 (Win32) PHP/5.5.12' (length=31)
'SERVER_NAME' => string 'localhost' (length=9)
'SERVER_ADDR' => string '127.0.0.1' (length=9)
'SERVER_PORT' => string '80' (length=2)
'REMOTE_ADDR' => string '127.0.0.1' (length=9)
'DOCUMENT_ROOT' => string 'C:/wamp/www/' (length=12)
'REQUEST_SCHEME' => string 'http' (length=4)
'CONTEXT_PREFIX' => string '' (length=0)
'CONTEXT_DOCUMENT_ROOT' => string 'C:/wamp/www/' (length=12)
'SERVER_ADMIN' => string 'admin@example.com' (length=17)
'SCRIPT_FILENAME' => string 'C:/wamp/www/variables_server/index.php' (length=36)
'REMOTE_PORT' => string '53356' (length=5)
'GATEWAY_INTERFACE' => string 'CGI/1.1' (length=7)
'SERVER_PROTOCOL' => string 'HTTP/1.1' (length=8)
'REQUEST_METHOD' => string 'GET' (length=3)
'QUERY_STRING' => string '' (length=0)
'REQUEST_URI' => string '/variables_server/' (length=16)
'SCRIPT_NAME' => string '/variables_server/index.php' (length=25)
'PHP_SELF' => string '/variables_server/index.php' (length=25)
'REQUEST_TIME_FLOAT' => float 1426360842.649
'REQUEST_TIME' => int 1426360842


J'espère que ce script gratuit vous sera utile dans vos projets.
Si vous souhaitez soutenir mon travail, un simple clic sur le bouton "Donner remercier" ci-dessous ou une note serait grandement apprécié. Merci pour votre générosité !
Votre réussite en ligne commence ici

Vous cherchez à pousser encore plus loin vos idées ou à les concrétiser avec un site internet sur mesure ? Je suis là pour vous aider ! Mon expérience en développement web est à votre disposition.

Que ce soit la création de votre site web pro ou l'apport de fonctionnalités avancées à votre projet, contactez-moi pour en discuter et avoir un devis gratuit personnalisé.

Mon objectif est de vous offrir des solutions sur mesure qui répondent à vos besoins, et votre vision associée à mon expertise donnera vie à votre projet web parfait. Contactez-moi aujourd'hui, je réponds en général en moins d'une heure :

Demander un devis
Réponse rapide !

Vous recherchez un script précis ?

Dites-moi ce dont vous avez besoin, je peux développer le script demandé et vous envoyer un mail dès qu'il est dispo !

🔔 Vous pouvez laisser votre mail pour recevoir les nouveaux scripts. Pas de pub, pas de tracas. Vous êtes libre de le supprimer à tout moment.

Je prends en compte toutes les demandes. Les idées les plus populaires passent en priorité et seront publiées dès qu'elles seront prêtes. 2842 demandes reçues.

Commentaires

Ajouter un commentaire

Commenter
Pseudo/Nom
Email
Message
Captcha
memo1memo2
Commenter
Ajoutez un commentaire, soyez le premier !

Retour à la liste des scripts

Un site à créer ?
Contactez-moi