public function addHits($pano_id)
{
$this->where('id','=',$pano_id);
$this->setInc('hits');
}实际运行报错如下:[8] ErrorException in Model.php line 1291
未定义数组索引: hits
public function setInc($field, $step = 1, $lazyTime = 0)
{
// 更新条件
$where = $this->getWhere();
$result = $this->getQuery()->where($where)->setInc($field, $step, $lazyTime);
dump($result);
dump($this->data);
if (true !== $result) {
$this->data[$field] += $step;
}
return $result;
}
/**
* 字段值(延迟)增长
* @access public
* @param string $field 字段名打印报错中显示的代码,result,得到结果1(并非true)打印报错中先死的代码,data,得到空数组.
int(1)
array(0) {
}实际上数据库已经更新了,我把if($result)的代码注释掉,就正常运行了,不知道是否有其他坑.这是怎么回事.
请问其他人有这个问题吗
最佳答案