php4的json类库及示例

json一种轻量级的数据格式,这个格式的数据可以很容易的被转换为javascript对象的格式,用于服务器端和客户端的数据传递,用于解决xml的过多冗余标签造成数据传输量过大的问题。然而php4没有直接处理json的方法。

JSON-PHP是一个自动完成JSON编码和解码的php开源代码工具。

下载:http://www.eb163.com/code/json.rar

其中的TEST_JSON.php中包含了PHPUnit.php,是PEAR自带的单元测试工具,实际开发中可以不用。

示例代码:

<?

//create a new instance of Services_JSON

require_once('JSON.php');

$json = new Services_JSON();

// convert a complex value to JSON notation

$value = array('name'=>'luoch','age'=> 25,'data'=>'foo');

$output = $json->encode($value);

print($output);

//采用post方式发送数据: json={"name":'luoch',"age":25,"data":"foo"}

print($_REQUEST['json']);

$value= $json->decode(str_replace('\\','',$_REQUEST["json"]));

var_dump( $value);

echo "<br>".$value->data;

?>

注意:如果中文无法显示,请将编码改为UTF-8

最新评论:

no.116443 ffhqndq 101.51.141.81 2020-03-31 23:59

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116432 xbxfgpk 58.149.49.186 2020-03-31 16:10

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116431 bwadkvx 36.71.8.81 2020-03-31 16:09

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116428 woufbty 156.0.229.194 2020-03-31 13:36

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116419 txkphrd 103.8.122.1 2020-03-31 08:37

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116418 lxtbtts 190.217.68.211 2020-03-31 08:35

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116416 bzfwiqm 103.83.175.51 2020-03-31 06:05

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116411 fjqenyg 36.89.149.127 2020-03-31 03:37

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116405 alelqvi 180.180.152.114 2020-03-31 01:17

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116401 rbpnrpm 124.194.83.172 2020-03-30 22:40

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116395 rssivdc 202.91.86.234 2020-03-30 17:23

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116377 jtjoqcd 210.210.154.3 2020-03-30 04:42

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116347 elckfos 212.19.20.87 2020-03-29 13:28

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116334 wmbmasp 103.83.175.51 2020-03-29 03:24

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116321 ruxnzbw 189.1.10.26 2020-03-28 19:47

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116315 vjsszaw 160.238.163.18 2020-03-28 17:12

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116310 frpblwk 85.252.123.110 2020-03-28 14:39

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116300 gyxpmoh 84.242.183.146 2020-03-28 09:41

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116290 zmgzeuu 210.245.51.43 2020-03-28 04:34

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116281 jikbrww 202.5.36.215 2020-03-27 21:01

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116278 nanitqy 88.135.40.134 2020-03-27 18:28

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116268 ukxioag 38.122.16.146 2020-03-27 13:22

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116267 ivjqgzg 202.87.249.254 2020-03-27 13:21

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116257 ryizrie 85.117.61.186 2020-03-27 08:21

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116250 rlaseln 103.144.164.15 2020-03-27 05:45

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116247 pyrfhjv 158.46.127.222 2020-03-27 03:11

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116246 xhicdvh 84.54.132.73 2020-03-27 00:44

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116240 xicnlgd 158.58.197.227 2020-03-26 22:10

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116239 tcioapw 210.2.157.130 2020-03-26 22:08

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116236 ugezmwb 1.55.1.133 2020-03-26 19:34

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116231 valuwmp 112.222.61.180 2020-03-26 17:06

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116219 jitphhk 186.159.1.58 2020-03-26 12:02

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116218 lzaylpn 175.41.44.36 2020-03-26 11:59

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116214 ncfzpth 82.117.212.114 2020-03-26 09:26

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116211 oeoqspc 200.71.73.129 2020-03-26 07:01

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116208 urcyoku 154.117.159.218 2020-03-26 04:22

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116193 bchxtdv 122.15.71.33 2020-03-25 21:27

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116189 urmzkiz 165.165.161.234 2020-03-25 18:43

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116178 kuuvgfq 109.169.65.145 2020-03-25 13:40

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116171 cnzbxvw 187.95.236.245 2020-03-25 11:10

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116166 hlllshr 118.71.253.20 2020-03-25 08:41

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116165 ktyrtdd 193.111.38.178 2020-03-25 08:39

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116140 ylxondd 176.117.255.182 2020-03-24 20:05

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116139 hghowdw 176.223.11.5 2020-03-24 20:02

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116126 qvzvzii 36.79.23.49 2020-03-24 12:21

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116125 ulntmvc 191.7.209.114 2020-03-24 12:18

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116118 dhyxwmt 37.26.85.98 2020-03-24 09:48

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116117 uezweaz 116.6.107.172 2020-03-24 09:47

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116096 zuuzsno 103.31.157.210 2020-03-23 21:11

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

no.116091 rlhvroy 46.32.10.66 2020-03-23 18:34

[url=https://www.instagram.com/batmanapollo/]Психолог онлайн[/url] https://www.instagram.com/batmanapollo/ <a href="https://www.instagram.com/batmanapollo/">Психолог онлайн</a>

发表评论:

邮箱: