免费PHP万能建站系统_社区团购SaaS_商城系统_软件开发_虚拟币交易所系统_矿机系统_微信钻石投票系统_成品源码

标题: PHP CURL把json转成数组 [打印本页]

作者: admin    时间: 2023-3-15 13:45
标题: PHP CURL把json转成数组
  1. $url = '';

  2. $ch = curl_init($url);  
  3. curl_setopt($ch,CURLOPT_ENCODING ,'gb2312');
  4. curl_setopt($ch, CURLOPT_TIMEOUT, 10);  
  5. curl_setopt($ch, CURLOPT_FAILONERROR, false);
  6. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  7. curl_setopt($ch, CURLOPT_HEADER, false);
  8. $result = curl_exec($ch);  
  9. curl_close($ch);  
  10. $result = json_decode($result,true);
  11. print_r($result);


复制代码
重点
  1. curl_setopt($ch, CURLOPT_FAILONERROR, false);
  2. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  3. curl_setopt($ch, CURLOPT_HEADER, false);
复制代码







欢迎光临 免费PHP万能建站系统_社区团购SaaS_商城系统_软件开发_虚拟币交易所系统_矿机系统_微信钻石投票系统_成品源码 (https://ourphp.net/club/) Powered by Discuz! X3.2