Home > Backend Development > PHP Tutorial > PHP transfer Json data between different pages sample code_PHP tutorial

PHP transfer Json data between different pages sample code_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:07:26
Original
1174 people have browsed it

gettest.php file:

Copy code The code is as follows:

$value["name"]= urlencode("my name");
$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 file is as follows:
Copy code The code is as follows:

$x = json_decode(stripslashes ($_GET["value"]), true);
echo urldecode($ x["name"]);
echo urldecode($x["pass"]);
?>

Enter in IE: http://127.0.0.1 :8080/gettest.php

Note: gettest.php, get.php file format is utf-8 format.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327538.htmlTechArticlegettest.php file: Copy the code as follows: ?php $value["name"]= urlencode("I name"); $value["pass"]= urlencode("pass888"); $value["age"]=30; $jsonstr =json_encode($value...
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template