當PB后臺開啟了獨立手機端后,也就意味著你做的不是響應式前端。
那么在判斷終端訪問上,PB是怎樣一個邏輯呢。通過查詢關(guān)鍵詞看到。
// 手機自適應主題 if ($this->config('open_wap')) { if ($this->config('wap_domain') && $this->config('wap_domain') == get_http_host()) { $this->setTheme(get_theme() . '/wap'); // 已綁域名并且一致則自動手機版本 } elseif (is_mobile() && $this->config('wap_domain') && $this->config('wap_domain') != get_http_host()) { if (is_https()) { $pre = 'https://'; } else { $pre = 'http://'; } header('Location:' . $pre . $this->config('wap_domain') . URL); // 手機訪問并且綁定了域名,但是訪問域名不一致則跳轉(zhuǎn) } elseif (is_mobile()) { // 其他情況手機訪問則自動手機版本 $this->setTheme(get_theme() . '/wap'); } else { // 其他情況,電腦版本 $this->setTheme(get_theme()); } } else { // 未開啟手機,則一律電腦版本 $this->setTheme(get_theme()); }
當為手機端時,自動識別為手機端模板文件。
可是在實際測試過程中發(fā)現(xiàn),使用IPAD時也會自動跳轉(zhuǎn)到手機端模板。但是對于一些特殊客戶,比如說需要做IPAD頁面的客戶來說,就不行了。
于是再繼續(xù)搜索關(guān)系詞找到。
// 是否為移動設(shè)備 function is_mobile() { $os = get_user_os(); if ($os == 'Android' || $os == 'iPhone' || $os == 'Windows Phone' || $os == 'iPad') { return true; } }
由此,我們看出,判斷移動設(shè)備的時候是把IPAD加在內(nèi)了。如果需要單獨開發(fā)IPAD,可以做成PC的響應,而在此將IPAD判斷刪除即可。