postman的get请求接口没问题 用php的curl_get 请求报错

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_29058883/article/details/82659030

查了半天原来是URL接口里面的中文字符惹的祸,

    $film='我不是药神';
        $film= urlencode($film);
//        $offset=0;
        $url="http://127.0.0.1:5000/weibo/hot?kwd={$film}&offset=0";

        $data=getHtml($url);
        $json_data =json_decode($data);//微博热门信息
        $this->ajaxReturn($json_data);die;

用urlrncode转下中文字符就行了

猜你喜欢

转载自blog.csdn.net/qq_29058883/article/details/82659030