<?php
namespace app\index\controller;
use think\Controller;
use think\Db;
use think\Cache;
use think\Url;
use think\Request;
/*
* 控制器
* Carey
* 2016年12月29日22:05:41
*/
class Index extends Controller {
//第一个方法
public function index(){
$list = Db::name('user')->where(array('name'=>array('<>','')))->paginate(10);
$this->assign('list',$list);
return view();
}
}上面的代码可以正常执行:<?php
namespace app\index\controller;
use think\Controller;
use think\Db;
use think\Cache;
use think\Url;
use think\Request;
/*
* 控制器
* Carey
* 2016年12月29日22:05:41
*/
class Index extends Controller {
//第一个方法
public function index(){
$list = Db::name('user')->where(array('name'=>array('neq','')))->paginate(10);
$this->assign('list',$list);
return view();
}
}无论是 NEQ 还是neq 都直接报错,找不到匹配的函数:[0] Exception in Builder.php line 198
查询表达式错误:neq
return $str;
}
// 检测操作符
if (!in_array($exp, $this->exp)) {
$exp = strtolower($exp);
if (isset($this->exp[$exp])) {
$exp = $this->exp[$exp];
} else {
throw new Exception('where express error:' . $exp);
}
}
$query = [];
if ('=' == $exp) {
// 普通查询
$query[$key] = $this->parseValue($value, $key);
} elseif (in_array($exp, ['neq', 'ne', 'gt', 'egt', 'gte', 'lt', 'lte', 'elt', 'mod'])) {
// 比较运算 最佳答案