PHP Server Information

$_SERVER เคเค‰เคŸเคพ superglobal variable เคนเฅ‹ เคœเคธเคฎเคพ headers, paths, เคฐ script locations เค•เฅ‹ เคœเคพเคจเค•เคพเคฐเฅ€ เคนเฅเคจเฅเค›เฅค

Important $_SERVER Elements

Element Description
$_SERVER['PHP_SELF'] Returns the filename of the currently executing script.
$_SERVER['SERVER_NAME'] Returns the name of the host server.
$_SERVER['HTTP_HOST'] Returns the Host header from the current request.
$_SERVER['HTTP_USER_AGENT'] Returns the user agent (browser) string.
$_SERVER['SCRIPT_NAME'] Returns the path of the current script.

Example

<?php
echo $_SERVER['PHP_SELF'];
echo "<br>";
echo $_SERVER['SERVER_NAME'];
?>