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 Michal Migurski <mike-json@teczno.com> * @author Matt Knapp <mdknapp[at]gmail[dot]com> * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com> * @copyright 2005 Michal Migurski * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $ * @license http://www.opensource.org/licenses/bsd-license.php * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
這樣在一堆有的沒的的地方就可以 用 JSON 儲存 繁複的資訊
也可以跟 Javascript 做資訊的傳遞, 非常適合AJAX 類的網頁使用