我有这个函数用于textsearch:
public function getData()
{
$term = Input::get('term');
/** check if any matches found in the database table */
$data = DB::table('items')->distinct()->select('item_name')->where('item_name', 'LIKE', $term . '%')->groupBy('item_name')->take(15)->get();
foreach ($data as $v) {
$return_array[] = array('value' => strtolower($v->item_name));
}
if (isset ($return_array)) {
return Response::json($return_array);
}
}
我没有任何包含符号的数据" _" (下划线)在我的数据库中,如果我输入_或多个_(__ ____ _____)我在输入字段中显示基于单词数量的结果,示例___将显示具有3个字符名称的项目,____具有4个字符名称的项目和等等。怎么可能?任何线索?