首页 > 代码库 > 服务器变量 超级全局数组$_SERVER (附加超简单表单与html5表单属性)

服务器变量 超级全局数组$_SERVER (附加超简单表单与html5表单属性)

001.html

<html><head><title>user log</title><meta http-equiv="content-type" content="text/html;charset:utf-8"></head><body><form method="post" action="001.php">用户名:<input type="text" name="user_name" required="required" placeholder="请填写用户名">//html5表单属性密码:<input type="password" name="pwd" required="required" placeholder="********">//html5表单属性<input type="submit" name="submit" value="log"></form></body></html>

001.php

<html><title>Welcome!!!</title><body><?php$name=$_POST[‘user_name‘];$pwd=$_POST[‘pwd‘];?><p align=‘center‘>Welcome new customer!</p><p align=‘center‘>Your username is <?php echo $name; ?><br>Your password is <?php echo $pwd; ?><br></p><!--$_SERVER比较常用的字段--><p align=‘center‘>根文件位于:<?php echo dirname($_SERVER["PHP_SELF"]) ?><br>服务器名称:<?php echo $_SERVER["SERVER_NAME"] ?><br>用的软件是:<?php echo $_SERVER["SERVER_SOFTWARE"] ?><br>http协议:<?php echo $_SERVER["SERVER_PROTOCOL"] ?><br>数据提交方法:<?php echo $_SERVER["REQUEST_METHOD"]."   接受请求的时间:".date(‘Y-m-d H:i:s‘,$_SERVER["REQUEST_TIME"]) ?><br>文件目录是:<?php echo $_SERVER["DOCUMENT_ROOT"] ?><br>代理:<?php echo $_SERVER["HTTP_USER_AGENT"] ?><br>IP地址:<?php echo $_SERVER["REMOTE_ADDR"] ?></p><!--服务器变量$_SERVER数组全部--><table width=‘100%‘ border=‘1‘><?php  foreach($_SERVER as $key=>$value){     echo <<<EOT     <tr>     <td width=‘25%‘>$key</td>     <td>$value</td>     </tr>EOT; } ?></table></body></html>

技术分享

服务器变量 超级全局数组$_SERVER (附加超简单表单与html5表单属性)