要在yii2中查找记录,我使用以下代码:
$response = Response::findOne(['unique_url' => $unique_url]);
但$unique_url
无论如何,它都会回归记录.如何做案例感慨?
我想你应该用 LIKE BINARY
为此你应该扩展你在查询条件中添加子句的modelSearch
public function search($params) { $query = YuorModel::find(); ....... ....... $query->andFilterWhere(['like binary', 'unique_url', $this->unique_url]) ->andFilterWhere(['like', 'your_field2', $this->your_field2]) .......