欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP在不同頁(yè)面間傳遞Json數(shù)據(jù)示例代碼

 更新時(shí)間:2013年06月08日 18:01:06   作者:  
本文為大家介紹下PHP如何在不同頁(yè)面間傳遞Json數(shù)據(jù),具體實(shí)現(xiàn)如下,感興趣的朋友可以參考下哈,希望對(duì)大家有所幫助
gettest.php文件:
復(fù)制代碼 代碼如下:

<?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文件如下:
復(fù)制代碼 代碼如下:

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

在IE中輸入:http://127.0.0.1:8080/gettest.php

注意:gettest.php,get.php文件的格式utf-8格式。

相關(guān)文章

最新評(píng)論