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

时间:2022-12-02 16:10:32
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, );
curl_setopt($ch, CURLOPT_TIMEOUT, );
$result =curl_exec($ch);
curl_close($ch);
$data=json_decode($result,true);
// $count=count($data);
// echo $count;
// die;
$this->assign('data',$data); $this->display();