这个问题已经在这里有了答案: > How can I make SQL case sensitive string comparison on MySQL? 11个
$aa = India::find();
$players = $aa
->where('player LIKE :query', [':query'=>'S%'])
->orderBy('position, player')->all();
$countnumber = $aa->count();
此代码返回结果,不区分大小写.
提供以“ S”或“ s”开头的播放器名称的结果.
但是我只想选择“ S”作为玩家名称.
如何在PHP Yii2 Framworok中限制它的大小写选择?
解决方法:
因此,您的Yii2代码应如下所示:
$players = India::find()
->where(['LIKE BINARY', 'player', $query_parameter])
->orderBy('position, player')->all();