Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/251.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel 5.6、MySQL 5.7无法选择新的JSON类型字段_Php_Mysql_Json_Laravel - Fatal编程技术网

Php Laravel 5.6、MySQL 5.7无法选择新的JSON类型字段

Php Laravel 5.6、MySQL 5.7无法选择新的JSON类型字段,php,mysql,json,laravel,Php,Mysql,Json,Laravel,我使用JSONType字段将一些数据存储在mysql中。 在Laravel5.6中,当我尝试选择查询我的json数据字段时,我得到一个异常 $transactions = DB::table('transactions') ->select('transactions.uuids_json', '... other columns') .... SQLSTATE[HY000]: General error: 2036, query exception 如果我删除uuid

我使用
JSON
Type字段将一些数据存储在
mysql
中。 在Laravel5.6中,当我尝试选择查询我的json数据字段时,我得到一个异常

 $transactions = DB::table('transactions')
       ->select('transactions.uuids_json', '... other columns')
....

SQLSTATE[HY000]: General error: 2036, query exception
如果我删除
uuids\u json
字段,一切正常。我一定要用原始语句还是什么

uuid\u json
数据字段包含如下行:

["1a7b29b8-5009-4266-8192-508930f2f92a", "3d52cfd5-d3c0-467f-8da1-cf81c344ad20", "cbe6e7fb-d806-49e2-8616-3c28afa012fe", "dfda9df5-2cbf-4cb8-aa54-a6dc23f73995"]
谢谢你的帮助

这听起来与

确保您的PHP安装使用的是mysqlnd5.0.11或更高版本,根据bug日志,该版本应该包括修复程序

检查
php-i
phpinfo()

如果无法升级到支持JSON数据类型的库版本,解决方法是将JSON列转换为字符串:

->select(\DB::raw("CAST(transactions.uuids_json as CHAR) as uuids_json"), ...)

您好,我使用的是
mysqlnd 5.0.12-dev
,我将尝试cast语句。也许说5.0.11解决了这个问题还为时过早。通过删除php mysql和(重新)安装php mysqlnd,我已经取得了成功。另外,请确保您拥有PHP5.6的最新小版本,目前是5.6.35。我将尝试一下,我正在使用PHP7.1.14,但可以切换到5.6米。我认为5.6适用于php,但它适用于laravel。7.1应该可以