例如,假设有以下JSON数据:
```json
{
"name": "John",
"age": 30,
"city": "New York"
}
```
可以使用以下代码来采集指定的内容:
```php
$jsonData = 'https://www.yisu.com/ask/{
"name": "John",
"age": 30,
"city": "New York"
}';
$data = https://www.yisu.com/ask/json_decode($jsonData);
$name = $data->name;
$age = $data->age;
$city = $data->city;
echo "Name: " . $name . "
";
echo "Age: " . $age . "
";
echo "City: " . $city . "
";
```
输出结果:
```
Name: John
Age: 30
City: New York
```
另外,如果JSON数据是一个包含多个元素的数组,可以使用`foreach`循环来遍历和采集每个元素的内容。