欢迎光临
我们一直在努力

例子:用getenv函数获取各种CGI环境变量-PHP教程,PHP应用

建站超值云服务器,限时71元/月

<?
$array = array(
               "remote_addr",
               "document_root",
               "gateway_interface",
               "server_software",
               "server_name",
               "server_protocol",
               "server_port",
               "server_admin",
               "server_signature",
               "request_method",
               "request_uri",
               "path_info",
               "path_translated",
               "script_name",
               "script_filename",
               "query_string",
               "remote_host",
               "remote_addr",
               "remote_user",
               "remote_ident",
               "content_type",
               "content_length",
               "http_accept",
               "http_accept_charset",
               "http_accept_language",
               "http_encoding",
               "http_user_agent",
               "http_connection",
               "http_host",
               "http_referer",
               "auth_type"
              );

echo <center>;
echo <table border="1" cellspacing="0" cellpadding="0">;
echo <caption>cgi environment variables</caption>;
echo <tr><th>name<th>value</tr>;

$count = count($array);
for($i=0;$i<$count;$i++){
   $value = getenv($array[$i]);
   if($value){
      echo "<tr><td>$array[$i]<td>" . $value . "</tr>";
   }
//下面的语句也可以哦
//   if(isset($$array[$i])){
//      echo "<tr><td>$array[$i]<td>" . $$array[$i] . "</tr>";
//   }
}

echo </table>;
echo </center>;
?>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 例子:用getenv函数获取各种CGI环境变量-PHP教程,PHP应用
分享到: 更多 (0)