作者 主題: 為什麼$HTTP_POST_VARS出不來??  (閱讀 3340 次)

0 會員 與 1 訪客 正在閱讀本文。

fell0206

  • 活潑的大學生
  • ***
  • 文章數: 339
    • 檢視個人資料
為什麼$HTTP_POST_VARS出不來??
« 於: 2007-05-10 01:07 »
各位大大,我在練習用表單傳值!並用PHP的語法接!
可是..我看書上說!全整寫法是:  $HTTP_POST_VARS["user"];
可是..我打了之後值都出不來!!
後來我改成 $_POST["user"];
就可以了!!可是...兩個不是一樣的東西嗎??
為什麼會這樣?? 請各位大大指點一下!! Thank you~~~

Yamaka

  • 俺是博士!
  • *****
  • 文章數: 4913
    • 檢視個人資料
    • http://www.ecmagic.com
為什麼$HTTP_POST_VARS出不來??
« 回覆 #1 於: 2007-05-10 01:38 »
HTTP POST variables: $_POST

    Note: Introduced in 4.1.0. In earlier versions, use $HTTP_POST_VARS.

An associative array of variables passed to the current script via the HTTP POST method. Automatically global in any scope.

This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_POST; to access it within functions or methods, as you do with $HTTP_POST_VARS.

$HTTP_POST_VARS contains the same initial information, but is not a superglobal. (Note that $HTTP_POST_VARS and $_POST are different variables and that PHP handles them as such)



PHP 官網的說明

http://tw.php.net/manual/en/reserved.variables.php