latin5_turkish_ci排序规则。charset=iso-8859-9app/config/database.php :
'charset' => 'latin5',
'collation' => 'latin5_turkish_ci',head.blade.php
<meta name="robots" content="all" />
<meta name="robots" content="index,follow" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1254" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
<meta http-equiv="Content-Type" content="text/html; charset=x-mac-turkish" />如何以正确的字符将值提交到数据库?
发布于 2015-08-17 13:20:55
好的,这是解决办法:
app/config/database.php :
'charset' => 'utf8',
'collation' => 'utf8_turkish_ci',head.blade.php
<META http-equiv=content-type content=text/html;charset=iso-8859-9>
<META http-equiv=content-type content=text/html;charset=windows-1254>
<META http-equiv=content-type content=text/html;charset=x-mac-turkish>然后,您将遇到排序问题,同时还会有一些有说服力的查询,例如:
$query = MyModal::where(function($query){
$query->where('id', '=', Session::get('id'))->where('abc', '=', iconv("cp1254","UTF-8","Türkişh Characters Included"));
})->orWhere(function($query){
$query->where('pidm', '=', Session::get('id'))->where('xyz', '=', iconv("cp1254","UTF-8","Türqüise Chars Again"));
})->orWhere(function($query){
$query->where('pidm', '=', Session::get('id'))->where('qwe', '=', iconv("cp1254","UTF-8","ğğşşüüöö"));
})->get();解决方案:
所以我使用i函数来创建一个解决方案。
附加信息:
正常的查询,如
$query = MyModal::where('id', '=', Session::get('id'))->get()
不会产生影响,但是如果雄辩的查询中有一个函数,您将得到一个错误,您应该使用iconv()。
谢谢。
https://stackoverflow.com/questions/32049359
复制相似问题