PHP:服务器变量列表

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP:服务器变量列表相关的知识,希望对你有一定的参考价值。

Here's a pretty comprehensive list of Server variables I use.
  1. //Information about the Server we're on
  2. echo "SERVER_NAME: " . $_SERVER['SERVER_NAME'] . "<br />";
  3. echo "SERVER_ADDR: " . $_SERVER['SERVER_ADDR'] . "<br />";
  4. echo "SERVER_PORT: " . $_SERVER['SERVER_PORT'] . "<br />";
  5.  
  6. echo "<br /><br />";
  7.  
  8. //Where are all the files located
  9. echo "DOCUMENT_ROOT: " . $_SERVER['DOCUMENT_ROOT'] . "<br />";
  10. //Path on the URL Address bar
  11. echo "php_SELF: " . $_SERVER['PHP_SELF'] . "<br />";
  12. //Path on the filesystem
  13. echo "SCRIPT_FILENAME: " . $_SERVER['SCRIPT_FILENAME'] . "<br />";
  14.  
  15. //Request details
  16. echo "REMOTE_ADDR: " . $_SERVER['REMOTE_ADDR'] . "<br />";
  17. echo "REMOTE_Port: " . $_SERVER['REMOTE_PORT'] . "<br />";
  18. echo "REQUEST_URI: " . $_SERVER['REQUEST_URI'] . "<br />";
  19. echo "QUERY_STRING: " . $_SERVER['QUERY_STRING'] . "<br />";
  20. echo "REMOTE_METHOD: " . $_SERVER['REQUEST_METHOD'] . "<br />";
  21. echo "REMOTE_TIME: " . $_SERVER['REQUEST_TIME'] . "<br />";
  22. //Who referred them to our website (YAHOO? GOOGLE?)
  23. echo "HTTP_REFERER: " . $_SERVER['HTTP_REFERER'] . "<br />";
  24. //Statistics
  25. echo "HTTP_USER_AGENT: " . $_SERVER['HTTP_USER_AGENT'] . "<br />";

以上是关于PHP:服务器变量列表的主要内容,如果未能解决你的问题,请参考以下文章

将数据从片段列表视图项传递到活动字符串变量 onitemclicklistener

php 变量片段

PHP MODx - 获取模板变量片段

PHP PHP:服务器变量列表

URL的PHP​​和哈希/片段部分

用于 WordPress 的 PHP 片段,用于获取所有产品子类别