使用PHP,当curl初始化时产生解析错误
PHPz
PHPz 2017-04-11 10:05:40
0
2
609

$arr = array(

0 => 'first', 1 => 'second', 2 => 'third' );

echo json_encode($arr);
echo "
";
echo 1234;
phpinfo();
?>

$ch = curl_init();//初始化
//   curl_setopt($ch, CURLOPT_URL, "http://localhost/info.php?type=json");//设置选项,包括URL
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_HEADER, 0);
  //执行并获取HTML文档内容
  $output = curl_exec($ch);
  //释放curl句柄
  curl_close($ch);
  //打印获得的数据
  print_r($output);
?>

PHPz
PHPz

学习是最好的投资!

reply all (2)
左手右手慢动作

将123.php删了重新写一遍再运行就行了,里面有隐藏字符

    黄舟

    楼上的 @凌云识木 隐藏字符我到时看不出来(~_~), 题主确认下curl扩展打开了没

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!