[請益] PHP內建變數

看板PHP作者 (涵涵)時間18年前 (2006/02/18 16:36), 編輯推噓2(202)
留言4則, 2人參與, 最新討論串1/1
最近開始撰寫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

02/18 16:49, , 2F
$_SERVER['PHP_SELF'] 這樣用才對吧!
02/18 16:49, 2F

02/18 16:56, , 3F
02/18 16:56, 3F

02/18 18:14, , 4F
嗯嗯,可以了,謝謝你^^
02/18 18:14, 4F
文章代碼(AID): #13zjoFjv (PHP)