简体   繁体   English

json_encode在开发服务器与实时服务器上的行为不同

[英]json_encode behaving differently on dev vs live servers

I am using laravel homestead (Ubuntu 14.04.1 LTS, PHP 5.6.3-1, NGINX 1.6.2, MYSQL 5.6.19-0) as my dev machine and am pushing live to (Ubuntu 14.04.2 LTS, PHP 5.6.6-1, Apache/2.4.12, MYSQL 5.5.41-0). 我将laravel homestead(Ubuntu 14.04.1 LTS,PHP 5.6.3-1,NGINX 1.6.2,MYSQL 5.6.19-0)用作我的开发机,并正在将其推向(Ubuntu 14.04.2 LTS,PHP 5.6)。 6-1,Apache / 2.4.12,MYSQL 5.5.41-0)。

On my development environment, when I return json from my laravel api, numbers always seem to passed as numbers. 在我的开发环境中,当我从laravel api返回json时,数字似乎总是以数字形式传递。 On the live server numbers are returned as strings. 在实时服务器上,数字以字符串形式返回。 I am trying to pinpoint if there is a setting or a version of one of the components that I need to change/upgrade. 我试图确定是否存在我需要更改/升级的组件之一的设置或版本。

What do I need to change to have my live server return numbers? 我需要更改什么才能拥有实时服务器返回号?

Since your live server is not using the php-mysqlnd driver, and your local server is using it, you are seeing the differences. 由于您的实时服务器未使用php-mysqlnd驱动程序,而本地服务器正在使用它,因此您会看到差异。 Install php-mysqlnd on your live server to get it right. 在您的实时服务器上安装php-mysqlnd以使其正确。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM