return false在codeigniter中不起作用

时间:2016-05-25 06:34:22

标签: codeigniter

以下是我的模特:

function timming($action)
{
    date_default_timezone_set('Asia/Calcutta'); 
    if($this->session->userdata('emp_dept') == 'XYZ') {
        $loginTime = "10:30:00 AM";
        if (time() >= strtotime($loginTime) && $action == 'sign_in') {
            return false ;
            } 
            else if( $action == 'sign_out') {
                $timeIn = $this->db
                    ->select('time_in')
                    ->from('attendence')
                    ->where('employee_id',$this->session->userdata('emp_id'))
                    ->where('date',date("Y-m-d"))
                    ->get()
                    ->row('time_in');
                $totalTime = time()- strtotime($timeIn) ;  //echo $totalTime ; die();  
                if($totalTime < 30600 )    
                    return false ;
                } else {
                    return true ;
                    }
                    } else {
                        return true ;
                        }
}

这是我的控制器部分

public function employee_attendence()
{
    if($this->session->userdata('emp_id')) {
        $action = $this->uri->segment(3);
        $timming = $this->employee->timming($action); echo $timming ; die();
        }
}

我的简单问题是,$ timming不是回真,也不是真的也不是假的...... 请帮我,我错了!!!

if (time() >= strtotime($loginTime) && $action == 'sign_in') 
 {
     $status = "no" ;
     return $status ;

如果像上面这样做,我得到正确的值为“不”

0 个答案:

没有答案