请求接口数据

function https_post($url,$data = null){

$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, "http://127.0.0.1/api/wx/active/active_list" );
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_HEADER, 0 );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );
$return = curl_exec ( $ch );
curl_close ( $ch );
return json_decode($return,true);
}

你可能感兴趣的:(请求接口数据)