';JsonSerializable';在ZendFramework2应用程序中未发现问题


'JsonSerializable' not found issue in ZendFramework 2 application

我的Zend 2项目中有一个条令实体,如下所示。

namespace Application'Entity;
use Doctrine'ORM'Mapping as ORM;
use JsonSerializable;
/**
 * @ORM'Entity
 * @author SWISS BUREAU
 *
 */
class ProductVersion implements JsonSerializable
{
    /**
     * @var $id
     * @ORM'Id
     * @ORM'Column(type="integer")
     * @ORM'GeneratedValue(strategy="AUTO")
     */
    protected $id;
    // continue...
    // JsonSerializable implementation available below..

我的php版本是

PHP 5.3.3 (cli) (built: Jul 12 2013 20:21:47)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

在应用程序执行时,我得到了以下错误。

Fatal error: Interface 'JsonSerializable' not found in /var/www/xx.....

可能的原因是什么?我该如何解决这个问题?

JsonSerializable@php.net

(PHP 5>=5.4.0)

您的PHP版本太低。与ZF2无关;)

接口JsonSerializable已在PHP 5.4或更高版本中开始受支持
您需要升级您的PHP版本才能使用它。