我想从多个json文件中回显数据,但是只有一个json文件可以正常工作。请帮我获取多个json文件。 THX
<?php
$water = file_get_contents('https://example.com/plant.json');
$wall = file_get_contents('https://example.com/door.json'); // How?
$decode = json_decode($water);
$data = $decode->data;
foreach ($data as $datas) {
echo '<div>' . $datas->ice . '</div>';
echo '<div>' . $datas->desk . '</div>';
}
/*
Content of plant.json file:
{"data":[
{"ice":eight,"desk":"six"},
{"ice":"ten","desk":"cup"}
]}
Content of door.json file:
{"data":[
{"ice":pen,"desk":"sing"},
{"ice":"bear","desk":"wire"}
]}
*/
?>