php - 如何查找包含大写或小写非拉丁短语的结果?(PHP,MySQL)
问题描述
我对非拉丁字符有一些问题。
询问:
SELECT * FROM table WHERE name LIKE '%{$phrase}%'
PHP:
$phrase = $_POST['phrase'];
//$phrase = strtolower/strtoupper($_POST['phrase']) made no differece
演示数据库:
Asomething (in the db stored as Asomething)
asomething (in the db stored as asomething)
Äsomething (in the db stored as Äsomething)
äsomething (in the db stored as äsomething)
我输入a或A,我得到了我想要的 - 两个 results,但是......如果我输入Ä,我只会得到一个包含大写字母的结果。我怎样才能得到他们两个?
编辑:我使用排序规则 utf8_general_ci
解决方案
尝试使用mb_strtolower($phrase , 'UTF-8');