且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在PHP 5.1中解码json?

更新时间:2023-02-23 12:05:32

在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.