CI 獲取UA

public function uaByCI(){
        $this->load->library('user_agent');

        if ($this->agent->is_browser()){
            $agent = $this->agent->browser();
        }elseif ($this->agent->is_robot()){
            $agent = $this->agent->robot();
        }elseif ($this->agent->is_mobile()){
            $agent = $this->agent->mobile();
        }else{
            $agent = 'Unidentified User Agent';
        }

        $ver    = $this->agent->version();

//        echo $agent;
        return  array('agent'=>$agent,"ver"=>$ver);
//        echo $this->agent->platform();
    }
相關文章
相關標籤/搜索