thinkphp 3.2 接收不到微信小程序端 post 提交的数据

场景: thinkphp3.2.3 后台接口为非url传参,微信小程序端用post传参
问题描述:接口取不到参数数据,用 I()函数,$_GET,$_REQUEST,$_POST等都取不到数据

解决:后台用 $data = file_get_contents("php://input");

public function edit_info()
{
    $tmp = file_get_contents("php://input");
    $arr = json_decode($tmp, true);

    /* $uid            = (int)I('post.user_id',0);;
    $store_name     = I('post.store_name','');
    $major_brand    = I('post.major_brand',''); */

    $uid            = $arr['user_id'];
    $store_name     = $arr['store_name'];
    $major_brand    = $arr['major_brand'];
    
}
原文地址:https://www.cnblogs.com/Jessie-candy/p/13575743.html