如何在Php中创建Json

如何在Php中创建Json,php,json,Php,Json,如何在Php中创建这样的Json [ [ "16226281", "11", "Disclosure.1994.720p.BluRay.H264.AAC-RARBG", "finished" ], [ "16226038", "140", "Courage The Cowardly Dog (1999-2002)", "finished" ], [ "16226020", "101", "[R.G. Mechan

如何在Php中创建这样的Json

[
 [
  "16226281",
   "11",
   "Disclosure.1994.720p.BluRay.H264.AAC-RARBG",
   "finished"
  ],
  [ 
   "16226038",
   "140",
   "Courage The Cowardly Dog (1999-2002)",
   "finished"
  ],
  [
   "16226020",
   "101",
   "[R.G. Mechanics] Call of Duty 4 Modern Warfare",
   "finished"
  ]
]
我在网上搜索了很多,但没有得到任何结果

$arr = [
 [
  "16226281",
   "11",
   "Disclosure.1994.720p.BluRay.H264.AAC-RARBG",
   "finished"
],
[ 
  "16226038",
  "140",
  "Courage The Cowardly Dog (1999-2002)",
  "finished"
 ],
 [
  "16226020",
  "101",
  "[R.G. Mechanics] Call of Duty 4 Modern Warfare",
  "finished"
 ]
]


echo json_encode($arr);
请点击以下链接:

只需创建一个数组

<?php
   $arr = array(
       array(
         "16226281",
         "11",
         "Disclosure.1994.720p.BluRay.H264.AAC-RARBG",
         "finished"
       ),
       # ....
     );

以下是一个使用内置JSON_encode PHP函数进行JSON编码的示例,该函数可以从PHP数组创建JSON格式的数据:

<?php
$arr = array(
'key 1' => "value 1",
'key 2' => "value 2",
'key 3' => "value 3"
);
echo json_encode($arr);
?>


来源:

是的,先生,phpif中的json数组如果你真的做过任何研究,你肯定不擅长:另请参见@AirBuddy use json_encode();看不到任何可能的复制品
<?php
$arr = array(
'key 1' => "value 1",
'key 2' => "value 2",
'key 3' => "value 3"
);
echo json_encode($arr);
?>