Rumah > Soal Jawab > teks badan
<?php
$arr = array(
0 => 'first',
1 => 'second',
2 => 'third'
);
echo json_encode($arr);
echo "<br/>";
echo 1234;
phpinfo();
?>
<?php
$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);
?>