$url = file_get_contents("http://api.themoviedb.org/3/movie/000008?append_to_response=credits,images&api_key=###");
$json = json_decode($url, true)
$inp = file_get_contents('test3.json');
$tempArray = json_decode($inp,true);
$test = array($title=>$json);
array_push($tempArray, $test);
$jsonData = json_encode($tempArray,JSON_FORCE_OBJECT);
file_put_contents('test3.json', $jsonData);
, wenn ich neue Array hinzufügen, erstellt es eine ID-Nummer wie diese ->wie man ein Array hinzufügt, ohne eine ID-Nummer zu erstellen?
"Ariel": {
"adult": false,
"backdrop_path": "\/z2QUexmccqrvw1kDMw3R8TxAh5E.jpg",
"belongs_to_collection": {
"id": 8384,
"name": "Proletariat Collection",
"poster_path": null,
"backdrop_path": "\/ibLeWo3X3dVo4rxvn4m3y90ms1I.jpg"
},
"0": {
"Varjoja paratiisissa": {
"adult": false,
"backdrop_path": "\/6YjUX87VtIEuDzanBE6obVxE9V3.jpg",
"belongs_to_collection": {
"id": 8384,
"name": "Proletariat Collection",
"poster_path": null,
"backdrop_path": "\/ibLeWo3X3dVo4rxvn4m3y90ms1I.jpg"
},
"1": {
"Life in Loops (A Megacities RMX)": {
"adult": false,
"backdrop_path": "\/udvB86uyzJ6P9vmB83WfrCbnmnI.jpg",
"belongs_to_collection": null,
"budget": 42000,
"genres": {
"0": {
"id": 99,
"name": "Documentary"
}
}
erste ist ok, aber dann fügt sie neue ID-Nummer befire Filmtitel .i Dont-ID-Nummer hinzufügen möchten. Kann mir bitte jemand helfen, wie man ein neues Array hinzufügt, ohne ID-Nummer zu erstellen?
Wo 'von – RiggsFolly
title' kommen $ Geben Sie uns ein Beispiel für die JSON-String Sie von der api bekommen – RiggsFolly