赞
踩
//调用页面testgetjson.php
post json datarequire_once("../json/json.php");
$strJson = file_get_contents('http://localhost/lian/testpostjson.php', 1000000);
echo "get json string:
/n";
echo "$strJson
/n";
$objJson = new Services_JSON();
$obj = $objJson->decode($strJson);
echo "the orgin data:
/n";
var_dump($objJson);
var_dump($obj);
echo "
/n";
?>
//被调用页面 testpostjson.php
require_once("../json/json.php");
$arr = array('name' => 'andylin', 'nick' => 'congfeng', 'contact' => array('email' =>'andylin02@126.com', 'website' => 'http://blog.csdn.net/andylin02'));
$objJson = new Services_JSON();
$strJson = $objJson->encode($arr);
echo "$strJson";
?>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。