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

WBOY
Release: 2016-06-13 12:47:19
Original
832 people have browsed it

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
Related labels:
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