-2
我有這個PHP代碼,它做了測試並運行它,如果測試結果爲真。但即使它得到錯誤的結果,CastResult也會忽略if檢查。爲什麼我的PHP如果週期不能正常工作
private function canVote($user,$id)
{
$userVoted = VoteModel::where('user',$user)->where('post',$id)->get();
if(count($userVoted)==0)
{
$canVote=true;
}
else {
$canVote=false;
}
return $canVote;
}
private function castVote($mode)
{
$user = Auth::getUser();
$id = $this->param('id');
if($this->canVote($user,$id))
{
$newVote = new VoteModel;
$newVote->user = $user['name'];
//other stuff
} else
{
Flash::error('Err');
}
}
是什麼'?CastVesult' – 2014-12-27 18:51:54
對不起,錯了,修正了它 – Hunrik 2014-12-27 19:07:31
好吧,現在它是'CastResult'這也是不可見的......? – 2014-12-28 07:37:41