作者共發了4篇帖子。 內容轉換:不轉換▼
 
點擊 回復
250 3
PHP5.2已经支持json了
一派護法 十九級
1樓 發表于:2015-1-25 10:23
<?php
$arr = array(array("id" => 1, "name" => "James"), array("id" => 2, "name" => "Iris"), array("id" => 3, "name" => "Mamá", "nickname" => "Difícil"));
$str = json_encode($arr);
echo $str;
?>

[{"id":1,"name":"James"},{"id":2,"name":"Iris"},{"id":3,"name":"Mam\u00e1","nickname":"Dif\u00edcil"}]
一派護法 十九級
2樓 發表于:2015-1-25 10:25
$arr = array(array("id" => 1, "name" => "James"), array("id" => 2, "name" => "Iris"), array("id" => 3, "name" => "Mamá", "nickname" => "Difícil"), "Español" => "El libro está en la caja.");

{"0":{"id":1,"name":"James"},"1":{"id":2,"name":"Iris"},"2":{"id":3,"name":"Mam\u00e1","nickname":"Dif\u00edcil"},"Espa\u00f1ol":"El libro est\u00e1 en la caja."}
一派護法 十九級
3樓 發表于:2015-1-25 10:27
$arr = array(array("id" => 1, "name" => "James"), array("id" => 2, "name" => "Iris"), array("id" => 3, "name" => "Mamá", "nickname" => "Difícil"), "Español" => "El libro está en la caja.", "Traditional Chinese" => "台灣正體中文");

{"0":{"id":1,"name":"James"},"1":{"id":2,"name":"Iris"},"2":{"id":3,"name":"Mam\u00e1","nickname":"Dif\u00edcil"},"Espa\u00f1ol":"El libro est\u00e1 en la caja.","Traditional Chinese":"\u53f0\u7063\u6b63\u9ad4\u4e2d\u6587"}
一派護法 十九級
4樓 發表于:2015-1-25 10:33
$arr = array();
$arr["English"] = "Where are you from?";
$arr["Español"] = "¿De dónde eres?";
$arr["Chinese"] = "你從哪裡來?";
$str = json_encode($arr);
echo htmlspecialchars($str)."<br><br>";

{"English":"Where are you from?","Espa\u00f1ol":"\u00bfDe d\u00f3nde eres?","Chinese":"\u4f60\u5f9e\u54ea\u88e1\u4f86\uff1f"}

回復帖子

內容:
用戶名: 您目前是匿名發表
驗證碼:
(快捷鍵:Ctrl+Enter)
 

本帖信息

點擊數:250 回複數:3
評論數: ?
作者:巨大八爪鱼
最後回復:巨大八爪鱼
最後回復時間:2015-1-25 10:33
 
©2010-2024 Arslanbar Ver2.0
除非另有聲明,本站採用共享創意姓名標示-相同方式分享 3.0 Unported許可協議進行許可。