ตรวจสอบ การเข้า web site

ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา ตรวจสอบ การเข้า web site

ตรวจสอบ การเข้า web site
class Admin extends CI_Controller {
 
public function __construct()
     {
     parent::__construct();
     $this->load->model('user_model');
     $this->load->model('login_model');
     }
function isMobileCheck2(){  
    $mobile_browser=false;  
    if(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i', strtolower($_SERVER['HTTP_USER_AGENT']))) {  
        $mobile_browser=true;  
    }  
    if((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml xml')>0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))) {  
        $mobile_browser=true;  
    }      
    $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'],0,4));  
    $mobile_agents = array(  
        'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',  
        'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',  
        'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',  
        'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',  
        'newt','noki','oper','palm','pana','pant','phil','play','port','prox',  
        'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',  
        'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',  
        'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',  
        'wapr','webc','winw','winw','xda','xda-');  
    if(in_array($mobile_ua,$mobile_agents)){  
        $mobile_browser=true;  
    }  
    if(strpos(strtolower($_SERVER['ALL_HTTP']),'OperaMini')>0){  
        $mobile_browser=true;  
    }  
    if(strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'windows')>0){  
        $mobile_browser=true;  
    }  
    return $mobile_browser;  
}  
 
public function index(){  
if(isMobileCheck2()){  
   $this->load->view('mobile/admin/index');  
}else{  
   $this->load->view('backend/admin/index');  
}     
}

จากฟังก์ชันดังกล่าวมันไม่ทำงานอ่ะครับ บทความจากที่นี่ครับ


Aong35258 124.120.217.xxx 29-04-2016 13:49:57

คำแนะนำ และการใช้งาน

สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก


  • ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
  • เปลี่ยน


    ( หรือ เข้าใช้งานผ่าน Social Login )

 ความคิดเห็นที่ 1
ประยุกต์การใช้งาน Mobile Detect PHP class ใน codeigniter อย่างง่าย 


ninenik 180.183.40.xxx 29-04-2016
 ความคิดเห็นที่ 2
ขอบคุณมากครับ


aong35258 124.120.217.xxx 29-04-2016 16:16






เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ