51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

PHP超全局变量获取一些信息

  <?php
  $referer = $_SERVER['HTTP_REFERER'];
  $ip = $_SERVER['REMOTE_ADDR'];
  $method = $_SERVER['REQUEST_METHOD'];
  $userAgent = $_SERVER['HTTP_USER_AGENT'];
  $requestUri = $_SERVER['REQUEST_URI'];
  $clientPort = $_SERVER['REMOTE_PORT'];
  echo "请求的来源页面的URL: " . $referer . "<br>";
  echo "客户端的IP地址: " . $ip . "<br>";
  echo "请求的方法: " . $method . "<br>";
  echo "客户端的User-Agent: " . $userAgent . "<br>";
  echo "请求的URI: " . $requestUri . "<br>";
  echo "客户端的端口号: " . $clientPort . "<br>";
  echo '----------------------------<br>';
  $serverSoftware = $_SERVER['SERVER_SOFTWARE'];
  $serverName = $_SERVER['SERVER_NAME'];
  $serverIP = $_SERVER['SERVER_ADDR'];
  $serverPort = $_SERVER['SERVER_PORT'];
  $documentRoot = $_SERVER['DOCUMENT_ROOT'];
  $scriptFilename = $_SERVER['SCRIPT_FILENAME'];
  $phpVersion = phpversion();
  $osInfo = php_uname();
  $currentTime = date('Y-m-d H:i:s');
  $timezone = date_default_timezone_get();

  echo "服务器软件名称和版本: " . $serverSoftware . "<br>";
  echo "服务器的主机名: " . $serverName . "<br>";
  echo "服务器的IP地址: " . $serverIP . "<br>";
  echo "服务器的端口号: " . $serverPort . "<br>";
  echo "当前服务器的文档根目录: " . $documentRoot . "<br>";
  echo "当前执行脚本的绝对路径和文件名: " . $scriptFilename . "<br>";
  echo "PHP版本: " . $phpVersion . "<br>";
  echo "操作系统信息: " . $osInfo . "<br>";
  echo "当前时间: " . $currentTime . "<br>";
  echo "服务器时区: " . $timezone . "<br>";
  ?>
赞(3)
未经允许不得转载:工具盒子 » PHP超全局变量获取一些信息