作者dreamdiary (涵涵)
看板PHP
标题[请益] PHP内建变数
时间Sat Feb 18 16:40:57 2006
最近开始撰写php程式,
以下的程式码是希望run出来後可以显示目前浏览者再看哪个php程式及其IP,
<?php
//Echo the script name
echo"You are running the file <b>$PHP_SELF</b>.<br/><br/>\n";
//Echo the user's information
echo'You are viewing this page
using:<br/><b>',$HTTP_USER_AGENT,'</b><br/>from the IP
address',$REMOTE_ADDR;
?>
但是执行时却跑出以下画面:
Notice: Undefined variable: PHP_SELF in c:\program
files\easyphp1-7\www\predefined.php on line 14
You are running the file .
You are viewing this page using:
Notice: Undefined variable: HTTP_USER_AGENT in c:\program
files\easyphp1-7\www\predefined.php on line 17
from the IP address
Notice: Undefined variable: REMOTE_ADDR in c:\program
files\easyphp1-7\www\predefined.php on line 17
不知道出了什麽问题,
register-globals设成开启的状态後还是无法解决,
麻烦各位解惑了,
谢谢^^
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 134.208.34.72
2F:→ chhuang:$_SERVER['PHP_SELF'] 这样用才对吧! 02/18 16:49
3F:推 chhuang: 02/18 16:56
4F:推 dreamdiary:嗯嗯,可以了,谢谢你^^ 02/18 18:14