作者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