知识屋:更实用的电脑技术知识网站
所在位置:首页 > 编程技术  > PHP编程

PHP在不同页面间传递Json数据示例

发表时间:2014-09-05来源:网络

gettest.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?id=100&value=$jsonstr"; 
 $html = file_get_contents($url); 
 echo $html;
?>

 

get.php文件如下:

<?php
 $x =  json_decode(stripslashes ($_GET["value"]), true);

 echo urldecode($x["name"]);
 echo urldecode($x["pass"]);
?>

 

 

(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏

上一篇php实战第十九天

下一篇php缩放图片

  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜