Home > AI > Language > PHP >

$_SERVER

$_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these; servers may omit some, or provide others not listed here. 

$_SERVER['REQUEST_METHOD']; // check if it is GET, POST, or others
$_SERVER['PHP_SELF']; // get the path of current file
$_SERVER['DOCUMENT_ROOT'];// get the directory path of current file

Leave a Reply