昨天在一台非常老的机器上面跑php,发现程序有些功能不行了,查询居然不支持json_encode函数
再看php版本是:5.1.6谁知道php哪个版本开始支持json_encode函数的?

解决方案 »

  1.   

    PHP 5 >= 5.2.0不支持也不要紧,不是还有一个 JSON.php 吗?
      

  2.   

    As of PHP 5.2.0, the JSON extension is bundled and compiled into PHP by default.
    建议楼主更新php吧……>=5.3.4
      

  3.   

    /**
     * (PHP 5 >= 5.2.0, PECL json >= 1.2.0)<br/>
     * Returns the JSON representation of a value
     * @link http://php.net/manual/en/function.json-encode.php
     * @param mixed $value <p>
     * The value being encoded. Can be any type except
     * a resource.
     * </p>
     * <p>
     * This function only works with UTF-8 encoded data.
     * </p>
     * @param int $options [optional] <p>
     * Bitmask consisting of JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_FORCE_OBJECT.
     * </p>
     * @return string a JSON encoded string on success.
     */从php 标准库来看,是php >=5.2.0 PECL json >= 1.2.0 时开始支持!
      

  4.   

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

  5.   

    看了一下,php 的头信息去掉了,现在是apache 的头信息。