zend framework语法问题
$item_id=$this->getRequest()->getParam("ID","no");
//过滤IP
$ip=$this->getRequest()->getServer("REMOTE_ADDR");
$today=date('Y').'-'.date('m').'-'.date('d');
$voteLogModel=new voteLog();
$where="ip='$ip' And vote_date=$today";
$res=$voteLogModel->fetchAll($where)->toArray();
if (count($res)>0){
$this->view->info="已经投过票了!";
$this->_forward("js","global");
//$this->_redirect("/");
return ;
}else{
//跟新前先添加一条日志到vote_log表
$data=array(
'ip'=>$ip,
'vote_date'=>$today,
'item_id'=>$item_id
);
if ($voteLogModel->insert($data)>0){
echo "ee";
exit();
$itemModel=new Item();
//通过主键直接获取对应的item
$item=$itemModel->find($item_id)->toArray();
$vote_count+=$item[0]['vote_count'];
$val=array(
'vote_count'=>$vote_count
);
$where="id=$item_id";
$itemModel->update($val, $where);
$this->_redirect("/");
}else {
$this->view->info="操作失败!";
$this->_forward("js","global");
return ;
}
}
为什么执行完insert,又会重新从第一行运行?