PHP语法(3.)环境变量

 1 <!--PHP的环境变量 -->
 2 <?php
 3 echo "环境变量\n";
 4 echo "浏览器的版本:"."$_SERVER['HTTP_USER_AGENT']"."\n";
 5 echo "客户端的IP地址:".$_SERVER['REMOTE_ADDR']."\n";
 6 echo "网站的主机名:".$SERVER['HTTP_HOST']."\n";
 7 echo "客户端的端口:".$SERVER['REMOTE_PORT']."\n";
 8 echo "网站所有的目录:".$SERVER['DOCUMENT_ROOT']."\n";
 9 echo "服务器的操作系统:".$SERVER['OS']."\n";
10 echo "服务器的系统路径:".$SERVER['PATH']."\n";
11 ?>
12 <!--PHP的系统常量 -->
13 <?php
14 echo "当前服务器操作系统:".PHP_OS."\n";
15 echo "当前PHP的版本:".PHP_VERSION."\n";
16 echo "当前的行号:"._LINE_."\n";
17 echo "当前的PHP文件:"._FILE_."\n\n";
18 $s=2;
19 echo "圆的半径:".$s."\n";
20 echo "圆的周长:".M_PI*2*$s."\n";
21 ?>

 

posted on 2012-06-03 09:30  端着咖啡码农  阅读(175)  评论(0编辑  收藏  举报