我在 Laravel 中有一个特定的问题。
当我使用echoorprint_r或var_dump我的数据(从 eloquent 检索)以正确的格式(UTF-8,希腊语)打印时。但是当我使用
return Response::json($data)
Run Code Online (Sandbox Code Playgroud)
返回类似的东西
"\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03bf\u03af \u03c7\u03b1\u03c1\u03b1\u03ba\u03c4\u03ae\u03c1\u03b5\u03c2"
Run Code Online (Sandbox Code Playgroud)
我已经在我的php.ini,中将 UTF-8 设置为默认字符集mysql.conf(但这不是问题)。
我尝试了几种方法来设置字符集,例如:
Response::json($data,200,$headers)
Run Code Online (Sandbox Code Playgroud)
其中 $headers 是一个数组:
'Content-type'=> 'application/json; charset=utf-8'
Run Code Online (Sandbox Code Playgroud)
但什么都没有改变。
我的操作系统是 Debian 7 wheezy 64 位,PHP 版本 5.5.13,MySQL 5.6.19 和 apache2 服务器。
在Windows IIS上升级到PHP 7.0.5(最后因为sqlsrv PDO驱动程序可用).我正在使用Laravel 5.1,当我尝试连接到FTP驱动器时,我从https://github.com/thephpleague/flysystem/blob/master/src/Adapter/Ftp.php#L19收到以下错误.
Use of undefined constant FTP_BINARY - assumed 'FTP_BINARY'
这是转移的PHP常量,所以不应该有问题,并且文档中没有任何内容可以说它已被弃用或任何东西.FTP_ASCII是一样的.我唯一做的就是改变PHP版本+ SQL驱动程序.