PHP example of passing Json data between different pages_PHP tutorial

WBOY
Release: 2016-07-14 10:11:35
Original
843 people have browsed it

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...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template