laravel5基于Eloquent ORM进行like模糊查询
$res= User::where('username','like', '%'.$keywords.'%')->orderby('id','desc')->paginate(15);
laravel 多个条件模糊查询
$keywords= $request->input('keywords'); $articles = DB::table('articles') ->where('content', 'like', $keywords.'%') ->orWhere('title', 'like', $keywords.'%') ->get();
使用Like搜索中文是不需要其它设置或操作的,对于这种全文搜索操作不建议使用like,最好是使用搜索引擎如ElasticSearch或者Sphinx等工具来实现