Home >Backend Development >PHP Tutorial >PHP不同页面间传递json的有关问题

PHP不同页面间传递json的有关问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:23:51831browse

PHP不同页面间传递json的问题
gettest.php:


$value["name"]= urlencode("myname");
$value["pass"]= urlencode("pass888");
$value["age"]=30;

$js_value = json_encode($value);

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

echo $html;
?>  

get.php:


$x =  json_decode(urldecode($_GET["value"]));
echo $x;
?>

在IE中运行: http://127.0.0.1:8080/gettest.php
运行后得到的是空白,应该能把json的数据打印出来吧

PHP
Statement:
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