📅  最后修改于: 2022-03-11 14:54:45.558000             🧑  作者: Mango
';
// Server name
echo 'Server name: '.$_SERVER['SERVER_NAME'].'
';
// HTTP host
echo 'HTTP host: '.$_SERVER['HTTP_HOST'].'
';
// Refering link
echo 'Refering link: '.$_SERVER['HTTP_REFERER'].'
';
// User agent
echo 'User agent: '.$_SERVER['HTTP_USER_AGENT'].'
';
// Script name
echo 'Script name: '.$_SERVER['SCRIPT_NAME'];
// The rest is optional
if($_SERVER['PHP_SELF']=='/filename.php'){
//If there is no folder
echo 'No folder'.$_SERVER['PHP_SELF'];
} else{
// Echo the name of the folder containing the PHP file
echo 'PHP file name: '.$_SERVER['PHP_SELF'];
}
// The same if statements can be used for the script name
if($_SERVER['SCRIPT_NAME']=='/filename.php'){
// If there is no folder
echo 'No folder'.$_SERVER['SCRIPT_NAME'];
} else{
// Echo the name of the folder containing the PHP file
echo 'PHP file name: '.$_SERVER['SCRIPT_NAME'];
}
echo 'More from me...';
// I hope you found this helpful!
?>