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'];
?>
echo $_SERVER['PHP_SELF'];
echo "<br>";
echo $_SERVER['SERVER_NAME'];
?>