PHP在不同页面间传递Json数据示例_PHP教程

原创
2016-07-14 10:11:35 584浏览

gettest.php文件:

$value["name"]= urlencode("我的姓名");
$value["pass"]= urlencode("pass888");
$value["age"]=30;

$jsonstr =json_encode($value);

$url="http://127.0.0.1:8080/get.php?id=100&value=$jsonstr";
$html = file_get_contents($url);
echo $html;
?>

get.php文件如下:

$x = json_decode(stripslashes ($_GET["value"]), true);

echo urldecode($x["name"]);
echo urldecode($x["pass"]);
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/477326.htmlTechArticlegettest.php文件: ?php $value[name]= urlencode(我的姓名); $value[pass]= urlencode(pass888); $value[age]=30; $jsonstr =json_encode($value); $url=http://127.0.0.1:8080/get.php...
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。