Categories: PHP

[PHP] JSON PHP 5.2.0以前的支援

if(!function_exists('json_decode')){
include("json.php");
$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
function json_decode($arr){
global $json;
return $json->decode($arr);
}
function json_encode($arr){
global $json;
return $json->encodeUnsafe($arr);
}
}

JSON Class 的名稱為 Services_JSON

* @category
* @package     Services_JSON
* @author &nbsp; &nbsp; &nbsp;Michal Migurski <mike-json@teczno.com>
* @author &nbsp; &nbsp; &nbsp;Matt Knapp <mdknapp[at]gmail[dot]com>
* @author &nbsp; &nbsp; &nbsp;Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
* @copyright &nbsp; 2005 Michal Migurski
* @version &nbsp; &nbsp; CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
* @license &nbsp; &nbsp; http://www.opensource.org/licenses/bsd-license.php
* @link &nbsp; &nbsp; &nbsp; &nbsp;http://pear.php.net/pepr/pepr-proposal-show.php?id=198

這樣在一堆有的沒的的地方就可以 用 JSON 儲存 繁複的資訊

也可以跟 Javascript 做資訊的傳遞, 非常適合AJAX 類的網頁使用

Mesak

我是米薩克,想了解更多可以點選  關於我 

Disqus Comments Loading...
Share
Published by
Mesak

Recent Posts

[教學] 利用 n8n 建立 LINE 聊天機器人

n8n 有多厲害,這邊就不贅述...

3 週 ago

[開箱] IROCKS K103R 熱插拔無線機械式鍵盤

許久沒有開箱了,近年鍵盤的規格...

3 個月 ago

[開箱] IROCKS-K85R 無線機械鍵盤

最近一直想要組一把 無線的 9...

1 年 ago

[開箱] IROCKS K75M 銀色上蓋機械式鍵盤

IROCKS K75M 這款鍵...

2 年 ago

[開箱] IROCKS M31E 粉紅色光學遊戲滑鼠

喜歡粉紅色周邊產品的朋友,有一...

2 年 ago