亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    關于升級php7后的報錯處理

    由于php7的出現(xiàn)帶來大幅的性能提升,想體驗下新版本帶來的特性,因此做了升級。

    發(fā)現(xiàn)在網(wǎng)站中請求接口時發(fā)生錯誤,排查后把解決方法記錄下來

    升級php后站點報錯,提示如下:

    Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set ‘a(chǎn)lways_populate_raw_post_data‘ to ‘-1‘ in php.ini and use the php://input stream instead. in Unknown on line 0 Warning: Cannot modify header information - headers already sent in Unknown on line 0

    通過查詢php官網(wǎng)后得知,在php5.6.X以后版本某些特性已經(jīng)被廢棄,詳情查看:

    http://php.net/manual/zh/migration56.deprecated.php

    原因是:

    $HTTP_RAW_POST_DATA 和 always_populate_raw_post_data

    使用 always_populate_raw_post_data 會導致在填充 $HTTP_RAW_POST_DATA 時產(chǎn)生 E_DEPRECATED 錯誤。

    請使用 php://input 替代 $HTTP_RAW_POST_DATA, 因為它可能在后續(xù)的 PHP 版本中被移除。

    設置 always_populate_raw_post_data 為 -1 (這樣會強制 $HTTP_RAW_POST_DATA 未定義,所以也不回導致 E_DEPRECATED 的錯誤) 來體驗新的行為。

    修復方法:

    1、修改php的配置文件,找到php.ini。把 always_populate_raw_post_data 開啟,并設置為 -1 。

    always_populate_raw_post_data = -1

    2、如果項目中有用到$HTTP_RAW_POST_DATA的更改為:

    原來是 $info = $HTTP_RAW_POST_DATA;

    更改為 $info = file_get_contents(‘php://input‘);

    推薦:《PHP7

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號