我的服务器配置:
[root@server ~]# php -v
PHP 7.0.22 (cli) (built: Aug 7 2017 16:18:27) ( NTS )
[root@server ~]# nginx -v
nginx version: nginx/1.10.2
操作系统:CentOS 7.3.1611 (Core)
我的YUM安装详情:
[root@server ~]# yum list installed | grep php
php70u-cli.x86_64 7.0.22-2.ius.centos7 @ius
php70u-common.x86_64 7.0.22-2.ius.centos7 @ius
php70u-fpm.x86_64 7.0.22-2.ius.centos7 @ius
php70u-fpm-nginx.noarch 7.0.22-2.ius.centos7 @ius
php70u-mysqlnd.x86_64 7.0.22-2.ius.centos7 @ius
php70u-pdo.x86_64 7.0.22-2.ius.centos7 @ius
以下是调查细节: 我尝试在test.php中执行以下代码:
以下是我的系统详情: PHP版本 => 7.0.22 操作系统: 我正试图在test2.php中执行以下代码:
<?php
$arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);
echo json_encode($arr);
?>
同时,出现了以下错误:
[root@server ~]# php /tmp/test2.php
**PHP Fatal error: Uncaught Error: Call to undefined function json_encode() in /tmp/test2.php:3**
如何解决这个问题?