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.117531 s9739viaf 91.225.208.84 2020-06-19 06:24

buy cialis online safely cialis black [url=https://wmmcialis.com/#]order cialis online[/url] generic cialis cheap cialis online <a href="https://topedstoreusa.com/#&quot;&gt;how much does cialis cost at walmart&lt;/a&gt; cialis 10mg printable cialis coupon

no.117483 l5690viar 148.77.34.200 2020-06-17 21:18

coupon for cialis cialis 20 mg price walmart [url=https://spcialisps.com/#]generic cialis india[/url] cialis for sale cialis 20mg price <a href="https://topedstoreusa.com/#&quot;&gt;buy cialis canada&lt;/a&gt; when will generic cialis be available cialis price walmart

no.117471 a9338vias 186.249.240.146 2020-06-17 18:57

generic cialis 2019 levitra vs cialis [url=https://spcialisps.com/#]levitra vs cialis[/url] cialis coupon generic cialis cost <a href="https://topedstoreusa.com/#&quot;&gt;cialis prices&lt;/a&gt; generic for cialis cialis coupon

no.117460 e3472viah 92.241.66.138 2020-06-17 11:38

generic viagra online for sale generic viagra [url=https://gemedjie.com/#]canadian viagra[/url] online viagra viagra coupons <a href="https://topedstoreusa.com/#&quot;&gt;viagra generic&lt;/a&gt; how much viagra should i take the first time? where to buy viagra

no.117451 b8710viaf 92.255.164.166 2020-06-17 05:38

viagra from india viagra 100mg price [url=https://gredichepri.com/#]buy viagra online cheap[/url] generic for viagra generic viagra <a href="https://topedstoreusa.com/#&quot;&gt;generic viagra without a doctor prescription&lt;/a&gt; viagra doses 200 mg over the counter viagra

no.117427 q9821viab 46.52.213.194 2020-06-16 01:55

price of viagra cost of viagra [url=https://gemedjie.com/#]order viagra online[/url] viagra 100mg price viagra price comparison <a href="https://topedstoreusa.com/#&quot;&gt;generic viagra walmart&lt;/a&gt; generic name for viagra viagra without a doctor prescription usa

no.117217 sildenafilprof 178.159.37.142 2020-05-24 13:27

<a href=" https://sildenafilprof.com ">buy generic viagra</a> viagra samples https://sildenafilprof.com

no.117216 sildviagra 178.159.37.60 2020-05-24 13:17

<a href=" https://sildenafilprof.com ">sildenafil</a> viagra prices

no.117197 sildviagra 178.159.37.60 2020-05-23 21:07

<a href=" https://sildenafilprof.com ">buy sildenafil online</a> viagra side effects

no.117196 sildenafilprof 178.159.37.142 2020-05-23 21:06

<a href=" https://sildenafilprof.com ">buy generic viagra</a> generic viagra india 100mg https://sildenafilprof.com

no.117139 g650viaz 46.172.69.163 2020-05-17 12:54

how to buy viagra cheap viagra [url=https://tjviagratj.com/#]viagra without a doctor prescription canada[/url] best place to buy viagra online viagra without a doctor prescription usa <a href="https://topedstoreusa.com/#&quot;&gt;buy generic 100mg viagra online&lt;/a&gt; viagra amazon viagra generic

no.117133 o922viao 50.242.100.89 2020-05-17 00:08

where to buy viagra viagra coupons [url=https://tjviagratj.com/#]viagra 100mg price[/url] viagra without prescription buy generic 100mg viagra online <a href="https://topedstoreusa.com/#&quot;&gt;viagra without a doctor prescription usa&lt;/a&gt; buy viagra generic viagra names

no.117132 a2735viag 31.10.110.132 2020-05-16 21:37

generic viagra viagra over the counter walmart [url=https://tjviagratj.com/#]online pharmacy viagra[/url] online viagra prescription when will viagra be generic <a href="https://topedstoreusa.com/#&quot;&gt;viagra online canada&lt;/a&gt; viagra 100mg price generic viagra walmart

no.117126 g6060viaj 95.143.135.226 2020-05-16 16:29

viagra online canada canadian viagra [url=https://kleoviagrahqb.com/#]viagra without a doctor prescription[/url] how to buy viagra best place to buy generic viagra online <a href="https://topedstoreusa.com/#&quot;&gt;cvs viagra&lt;/a&gt; online doctor prescription for viagra where can i buy viagra over the counter

no.117123 a5427vias 95.65.124.252 2020-05-16 13:56

roman viagra where to buy viagra [url=https://tjviagratj.com/#]cheap viagra 100mg[/url] viagra coupon viagra cost per pill <a href="https://topedstoreusa.com/#&quot;&gt;viagra discount&lt;/a&gt; viagra where to buy viagra

no.117098 p2718viai 209.16.78.27 2020-05-15 15:10

viagra discount price of viagra [url=https://tjviagratj.com/#]amazon viagra[/url] otc viagra cheap viagra <a href="https://topedstoreusa.com/#&quot;&gt;over the counter viagra cvs&lt;/a&gt; viagra cost viagra prices

no.117087 d2825viab 91.213.119.246 2020-05-15 07:37

goodrx viagra viagra price [url=https://tjviagratj.com/#]best place to buy generic viagra online[/url] viagra online viagra over the counter usa 2019 <a href="https://topedstoreusa.com/#&quot;&gt;viagra doses 200 mg&lt;/a&gt; buy viagra online usa no prescription viagra

no.117079 p1623viav 194.28.80.105 2020-05-14 23:56

generic for viagra buying viagra online [url=https://kleoviagrahqb.com/#]how much does viagra cost[/url] 100mg viagra is there a generic for viagra <a href="https://topedstoreusa.com/#&quot;&gt;viagra walgreens&lt;/a&gt; how much will generic viagra cost buy viagra online

no.117076 h3097viau 185.14.148.74 2020-05-14 21:22

buy viagra online cheap viagra cost per pill [url=https://tjviagratj.com/#]canadian pharmacy generic viagra[/url] cheap viagra viagra 100mg <a href="https://topedstoreusa.com/#&quot;&gt;buy real viagra online&lt;/a&gt; cheap viagra 100mg mexican viagra

no.117057 f2050vias 81.17.94.50 2020-05-14 08:46

generic viagra walmart viagra coupon [url=https://kleoviagrahqb.com/#]viagra coupons[/url] viagra for men online how to get viagra <a href="https://topedstoreusa.com/#&quot;&gt;mail order viagra&lt;/a&gt; viagra generic generic viagra online for sale

no.117056 e4068viau 187.1.57.38 2020-05-14 08:45

buy generic 100mg viagra online viagra online canadian pharmacy [url=https://kleoviagrahqb.com/#]cvs viagra[/url] cheapest generic viagra viagra without a doctor prescription usa <a href="https://topedstoreusa.com/#&quot;&gt;is there a generic viagra&lt;/a&gt; where to get viagra generic viagra online

no.117044 c2149viam 120.50.8.2 2020-05-13 20:06

viagra amazon otc viagra [url=https://kleoviagrahqb.com/#]cvs viagra[/url] order viagra online viagra price comparison <a href="https://topedstoreusa.com/#&quot;&gt;is there a generic for viagra&lt;/a&gt; walmart viagra walmart viagra

no.117042 j4354viay 210.245.51.26 2020-05-13 18:06

viagra pills walmart viagra [url=https://tjviagratj.com/#]best place to buy generic viagra online[/url] online viagra otc viagra <a href="https://topedstoreusa.com/#&quot;&gt;buy viagra&lt;/a&gt; viagra prices viagra from india

no.116867 edpillphrm 178.159.37.142 2020-04-26 05:51

viagra alternatives <a href=" https://edpillsphrm.com ">buy generic ed pills online</a> how much is viagra

no.116863 canadaviagra 178.159.37.60 2020-04-26 02:44

cheapest viagra <a href=" https://edpillsphrm.com ">buy generic ed pills online</a> what is viagra

no.116849 edpillphrm 178.159.37.142 2020-04-25 11:55

generic viagra without subscription walmart <a href=" https://edpillsphrm.com ">canadian pharmacy</a> online viagra

no.116847 canadaviagra 178.159.37.60 2020-04-25 10:28

cheap viagra <a href=" https://edpillsphrm.com ">buy generic ed pills online</a> levitra vs viagra

no.116810 viagraon 178.159.37.60 2020-04-24 03:01

generic viagra available in usa <a href=" https://viagrawithoutdoctorspres.com ">viagra effects</a> how long does it take for viagra to work

no.116808 viagraus 178.159.37.142 2020-04-24 02:32

sildenafil 20 mg vs viagra <a href=" https://viagrawithoutdoctorspres.com ">canadian pharmacy viagra</a> viagra samples from pfizer

no.116789 viagraon 178.159.37.60 2020-04-23 11:15

viagra online <a href=" https://viagrawithoutdoctorspres.com ">female viagra</a> cialis vs viagra

no.116784 viagraus 178.159.37.142 2020-04-23 10:08

how much does viagra cost <a href=" https://viagrawithoutdoctorspres.com ">viagra online pharmacy</a> viagra pill

no.116748 viastormik 178.159.37.142 2020-04-21 04:48

what is viagra <a href=" https://canadianpharmacystorm.com ">pain meds online without doctor prescription</a> online viagra

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>

发表评论:

邮箱: