-2
이 PHP 코드는 테스트를 수행하고 테스트 결과가 true이면 실행합니다. 그러나 잘못된 결과를 얻더라도 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' 무엇인가? –
죄송합니다. 잘못 입력 했으므로 수정했습니다. – Hunrik
이제 CastResult도 보이지 않습니다 ...? –