在PHP中发送GET请求可以使用file_get_contents()函数或者cURL扩展库。
使用file_get_contents()函数:
$url = 'http://example.com/api/users'; $response = file_get_contents($url); echo $response; 使用cURL扩展库:
$url = 'http://example.com/api/users'; $curl = curl_init($url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($curl); curl_close($curl); echo $response;
免责声明:本站内容(文字信息+图片素材)来源于互联网公开数据整理或转载,仅用于学习参考,如有侵权问题,请及时联系本站删除,我们将在5个工作日内处理。联系邮箱:chuangshanghai#qq.com(把#换成@)

QQ客服