如何在PHP 5.1中解码json? [英] How can I decode json in PHP 5.1?

查看:111
本文介绍了如何在PHP 5.1中解码json?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

json_decode函数不是PHP 5.1的一部分,所以我不能使用它.此版本还有其他功能吗?

json_decode function is not part of PHP 5.1, so I cannot use it. Is there any other function for this version?

推荐答案

在PHP 5.2之前,您可以使用 JSON PECL扩展名.

Before PHP 5.2, you can use the JSON PECL extension.

实际上,它是已集成到PHP 5.2中的扩展(

In fact, it is the extension that has been integrated into PHP 5.2 (quoting) :

从PHP 5.2.0开始,JSON扩展为 捆绑并通过以下方式编译成PHP 默认.

As of PHP 5.2.0, the JSON extension is bundled and compiled into PHP by default.


其他解决方案是使用PHP开发的某些组件.


Some other solutions would be to use some component developped in PHP.

前一段时间(大约一年前),我使用了 Zend_Json Zend Framework的组件,以及PHP 5.1.

Some time ago (about one year ago), I used the Zend_Json component of Zend Framework, with PHP 5.1.

即使Zend Framework需要PHP 5.2,也可以提取该组件(我认为它仅依赖于另一个组件-可能是Zend_Exception或类似的东西)-并且一年以前,可以在PHP 5.1中使用它.

Even if Zend Framework requires PHP 5.2, that component can be extracted (I think it depends only on one other component -- maybe Zend_Exception, or something like that) -- and one year ago, it was possible to use it with PHP 5.1.


官方JSON网站也链接到几个基于PHP或面向PHP的组件-您可能想看看该列表.


The official JSON website also links to several PHP-based or PHP-oriented components -- you might want to take a look at that list.

这篇关于如何在PHP 5.1中解码json?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆