$ SERVER-Superglobal in Hindi
$_SERVER ये superglobal Server के बारे में सब information provide करता है | $_SERVER array में headers, paths और script locations की information रखी जाती है | यहाँ पर Web server द्वारा array पर entries create की जाती है |
Total Elements for $_SERVER Localhost
[MIBDIRS] => E:/xampp/php/extras/mibs
[MYSQL_HOME] => \xampp\mysql\bin
[OPENSSL_CONF] => E:/xampp/apache/bin/openssl.cnf
[PHP_PEAR_SYSCONF_DIR] => \xampp\php
[PHPRC] => \xampp\php
[TMP] => \xampp\tmp
[HTTP_HOST] => localhost
[HTTP_CONNECTION] => keep-alive
[HTTP_CACHE_CONTROL] => max-age=0
[HTTP_UPGRADE_INSECURE_REQUESTS] => 1
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
[HTTP_ACCEPT_ENCODING] => gzip, deflate, sdch, br
[HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.8
[HTTP_COOKIE] => PHPSESSID=bgdd02dtd10daqr2h0pcg7phq0
[PATH] => C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
[SystemRoot] => C:\WINDOWS
[COMSPEC] => C:\WINDOWS\system32\cmd.exe
[PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
[WINDIR] => C:\WINDOWS [SERVER_SIGNATURE] =>Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.0.9 Server at localhost Port 80
[SERVER_SOFTWARE] => Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.0.9
[SERVER_NAME] => localhost [SERVER_ADDR] => ::1
[SERVER_PORT] => 80
[REMOTE_ADDR] => ::1
[DOCUMENT_ROOT] => E:/xampp/htdocs
[REQUEST_SCHEME] => http
[CONTEXT_PREFIX] => [CONTEXT_DOCUMENT_ROOT] => E:/xampp/htdocs
[SERVER_ADMIN] => postmaster@localhost
[SCRIPT_FILENAME] => E:/xampp/htdocs/Variables.php
[REMOTE_PORT] => 55187
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /Variables.php
[SCRIPT_NAME] => /Variables.php
[PHP_SELF] => /Variables.php
[REQUEST_TIME_FLOAT] => 1487750170.283
[REQUEST_TIME] => 1487750170
$_SERVER Array के कुछ महत्वपूर्ण Elements
Elements | Descriptionn |
---|---|
$_SERVER["PHP_SELF"] | Current file name; return किया जाता है | |
$_SERVER["SERVER_ADDR"] | Host server का ip address return करता है | |
$_SERVER["SERVER_NAME"] | Host server का name return किया जाता है | |
$_SERVER["GATEWAY_INTERFACE"] | इस्तेमाल हो रहे server का CGI(Common Gateway Interface) version return किया जाता है | |
$_SERVER["REQUEST_METHOD"] | इस्तेमाल कर रहे method को return किया जाता है | |
$_SERVER["SERVER_SOFTWARE"] | इस्तेमाल हो रहे Server का name return किया जाता है | |
$_SERVER["SERVER_PROTOCOL"] | protocol की information return करता है | |
$_SERVER["REQUEST_TIME"] | Request start से अबतक का timestamp return करता है | |
$_SERVER["HTTP_HOST"] | Current request के host को return करता है | |
$_SERVER["QUERY_STRING"] | अगर page query string इस्तेमाल कर रहा है तो Query string को return किया जाता है | |
$_SERVER["REMOTE_PORT"] | User web server से कौनसे port से communicate करता है वो PORT return किया जाता है | |
$_SERVER["SCRIPT_FILENAME"] | Current script का path file name के साथ return किया जाता है | |
$_SERVER["SCRIPT_NAME"] | Current script का path return किया जाता है | |
Output :123456789101112131415<?php
echo "PHP_SELF : ".$_SERVER["PHP_SELF"]."<br />";
echo "SERVER_ADDR : ".$_SERVER["SERVER_ADDR"]."<br />";
echo "SERVER_NAME : ".$_SERVER["SERVER_NAME"]."<br />";
echo "GATEWAY_INTERFACE : ".$_SERVER["GATEWAY_INTERFACE"]."<br />";
echo "REQUEST_METHOD : ".$_SERVER["REQUEST_METHOD"]."<br />";
echo "SERVER_SOFTWARE : ".$_SERVER["SERVER_SOFTWARE"]."<br />";
echo "SERVER_PROTOCOL : ".$_SERVER["SERVER_PROTOCOL"]."<br />";
echo "REQUEST_TIME : ".$_SERVER["REQUEST_TIME"]."<br />";
echo "HTTP_HOST : ".$_SERVER["HTTP_HOST"]."<br />";
echo "QUERY_STRING : ".$_SERVER["QUERY_STRING"]."<br />";
echo "REMOTE_PORT : ".$_SERVER["REMOTE_PORT"]."<br />";
echo "SCRIPT_FILENAME : ".$_SERVER["SCRIPT_FILENAME"]."<br />";
echo "SCRIPT_NAME : ".$_SERVER["SCRIPT_NAME"]."<br />";
?>
PHP_SELF : /Variables.php
SERVER_ADDR : ::1
SERVER_NAME : localhost
GATEWAY_INTERFACE : CGI/1.1
REQUEST_METHOD : GET
SERVER_SOFTWARE : Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.0.9
SERVER_PROTOCOL : HTTP/1.1
REQUEST_TIME : 1487756312
HTTP_HOST : localhost
QUERY_STRING :
REMOTE_PORT : 55941
SCRIPT_FILENAME : E:/xampp/htdocs/Variables.php
SCRIPT_NAME : /Variables.php