Thinkphp中controller控制器根据curl函数请求数据

public function member(){
        $url="http://aitequn.tjnit.com/UserAction_findAllUser";
        $ch =curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        $result =curl_exec($ch);
        curl_close($ch);
        $data=json_decode($result,true);
//        $count=count($data);
//        echo $count;           
//        die;
        $this->assign('data',$data);

        $this->display();
原文地址:https://www.cnblogs.com/kangshuai/p/5938436.html