json=[ { Name: "沈涛", ReleaseYear: "1984" }, { Name: "The Red Violin", ReleaseYear: "1998" }];
可以这样写$arr = array(0 => array( 'name' => '沈涛', 'ReleaseYear' => '1984'),1 => array('name' => 'The Red Violin', 'ReleaseYear' => '1984' )) 然后再json_encode,然后在页面再用js解析json。
1.data.json
{
"name":”yudabo“,
"score":100
}
2.json.php
$json_string = file_get_contents('json/data.json');
$data = json_decode($json_string, true);
echo $data['name'].' '.$data['score'];