初學php遇到的 $HTTP_RAW_POST_DATA 問題

來源:互聯網
上載者:User
Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0

我做小例子的時候報這種錯誤,網上都說是把always_populate_raw_post_data' 設定成 '-1',但是我去php.ini裡面看了,預設的設定就是-1。哪位大神能夠指點一下


回複討論(解決方案)

Deprecated 中文釋義:過時的
顯然你的 php 版本比較高
在高版本 php 的發版說明中都有 $HTTP_RAW_POST_DATA 即將(已經)取消,請改用從 php://input 中讀取 的聲明

設原來是 $s = $HTTP_RAW_POST_DATA;
應寫作 $s = file_get_contents('php://input');
多打幾個字而已

$HTTP_RAW_POST_DATA 這個被廢棄了,在將來的php版本中還會移除。
讓你用 php://input 代替

$GLOBALS['HTTP_RAW_POST_DATA'] 我是用這個寫法

This feature has been DEPRECATED as of PHP 5.6.0. Relying on this feature is highly discouraged.
$HTTP_RAW_POST_DATA 包含 POST 提交的未經處理資料。

一般而言,使用 php://input 代替 $HTTP_RAW_POST_DATA。

並沒有用到¥GTTP_RAW_POST_DATA...我只是用到了POST方法

$HTTP_RAW_POST_DATA 已經廢棄了
應該用 file_get_contents('php://input');來擷取

$GLOBALS['HTTP_RAW_POST_DATA']也一樣
說不定一升級版本HTTP_RAW_POST_DATA讀出來就空了
全域替換成file_get_contents('php://input') 就行了

Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0

表示$HTTP_RAW_POST_DATA 已經廢棄了,所以應該使用file_get_contents('php://input');來擷取

應該是phpstorm破解版不能使用post方法

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.