Php 雄辩的功能在本地主机上工作,但在linux web服务器上中断

Php 雄辩的功能在本地主机上工作,但在linux web服务器上中断,php,laravel,Php,Laravel,这个简短而雄辩的firstOrCreate函数在linux web服务器上不起作用。我在windows上的localhost中进行了尝试,其工作正常,但正如您在下面看到的异常,查询字符串编码不正确 在Laravel 5.8上运行 PHP7.3和MySQL 5.7 $search = SearchHistory::firstOrCreate([ 'ip_address' => request()->ip(),

这个简短而雄辩的firstOrCreate函数在linux web服务器上不起作用。我在windows上的localhost中进行了尝试,其工作正常,但正如您在下面看到的异常,查询字符串编码不正确

在Laravel 5.8上运行 PHP7.3和MySQL 5.7

$search = SearchHistory::firstOrCreate([
                    'ip_address'    => request()->ip(),
                    'data'          => json_encode(request()->query())
                ], [
                    'user_id'       => auth()->id() ?? 0,
                    'user_agent'    => request()->userAgent()
                ]);
格式化的查询应类似于:

select * from `search_histories` where (`ip_address` = '127.0.0.1' and `data` = '{\"inc_surrounding\":\"on\",\"address\":\"Surry Hills, New South Wales, Australia\"}') limit 1
但是我得到了这个错误

Illuminate \ Database \ QueryException (HY000)
SQLSTATE[HY000]: General error: 2036 (SQL: select * from `search_histories` where (`ip_address` = 27.34.72.242 and `data` = {"address":"Surry Hills, New South Wales, Australia","radius":"10","price":{"min":"100000","max":"800000"},"bedroom":"0","bathroom":"0","parking":"0","land_size":{"min":null,"max":null}}) limit 1)

您通常可以忽略这些错误消息中的编码。它们是通过PDO插入的,所以只要使用正确的方法,它就是正确的。您是否运行了所有迁移?请尝试,是的,我的所有迁移都是最新的。好的,我已经解决了,谢谢。您通常可以忽略这些错误消息中的编码。它们是通过PDO插入的,所以只要使用正确的方法,它就是正确的。你运行了所有迁移吗?试试看,是的,我所有的迁移都是最新的。好的,我已经解决了,谢谢。