??? ?? ?? ???? ????? Thinkphp ??: 1. "appcommon.php" ?? ???? "function isMobile(){...}"? ????. 2. ??? ?? ?? ????? ??? ??? ?????. module ; 3. true? ???? "mobile/index" ???? ????, ??? ??? ?? PC ? ???? ??? ?????.
? ????? ?? ??: Windows 10 ???, thinkphp ?? 5, Dell G3 ???.
thinkphp? ??? ?? ?? ???? ??? ???? ? ????
thinkphp5? ??? ?? PC ???? ???? ?? ???? ?????.
appcommon.php ?? ???? ?? ??? ????.
function isMobile() { if (isset($_SERVER[‘HTTP_X_WAP_PROFILE’])) { return true; } if (isset($_SERVER[‘HTTP_VIA’])) { return stristr($_SERVER[‘HTTP_VIA’], “wap”) ? true : false; } if (isset($_SERVER[‘HTTP_USER_AGENT’])) { $clientkeywords = array(‘nokia’, ‘sony’, ‘ericsson’, ‘mot’, ‘samsung’, ‘htc’, ‘sgh’, ‘lg’, ‘sharp’, ‘sie-‘, ‘philips’, ‘panasonic’, ‘a(chǎn)lcatel’, ‘lenovo’, ‘iphone’, ‘ipod’, ‘blackberry’, ‘meizu’, ‘a(chǎn)ndroid’, ‘netfront’, ‘symbian’, ‘ucweb’, ‘windowsce’, ‘palm’, ‘operamini’, ‘operamobi’, ‘openwave’, ‘nexusone’, ‘cldc’, ‘midp’, ‘wap’, ‘mobile’); if (preg_match(“/(” . implode(‘|’, $clientkeywords) . “)/i”, strtolower($_SERVER[‘HTTP_USER_AGENT’]))) { return true; } } if (isset($_SERVER[‘HTTP_ACCEPT’])) { if ((strpos($_SERVER[‘HTTP_ACCEPT’], ‘vnd.wap.wml’) !== false) && (strpos($_SERVER[‘HTTP_ACCEPT’], ‘textml’) === false || (strpos($_SERVER[‘HTTP_ACCEPT’], ‘vnd.wap.wml’) < strpos($_SERVER[‘HTTP_ACCEPT’], ‘textml’)))) { return true; } } return false; }
?? ?? ??? ?? ??? public ????? ??? ??? ?????. true? ???? ???/??? ???(??? ? ????)? ????, ??? ??? ?? PC ? ???? ??
public function _initialize(){ if(isMobile()){ $this->redirect(‘mobile/index’); } }
???? ?????. 2
app/common? ???? ?????. php ?? ???
// 應(yīng)用公共文件 //判斷客戶端訪問方式 function ismobile() { // 如果有HTTP_X_WAP_PROFILE則一定是移動設(shè)備 if (isset ($_SERVER[‘HTTP_X_WAP_PROFILE’])) return true; //此條摘自TPM智能切換模板引擎,適合TPM開發(fā) if(isset ($_SERVER[‘HTTP_CLIENT’]) &&’PhoneClient’==$_SERVER[‘HTTP_CLIENT’]) return true; //如果via信息含有wap則一定是移動設(shè)備,部分服務(wù)商會屏蔽該信息 if (isset ($_SERVER[‘HTTP_VIA’])) //找不到為flase,否則為true return stristr($_SERVER[‘HTTP_VIA’], ‘wap’) ? true : false; //判斷手機發(fā)送的客戶端標志,兼容性有待提高 if (isset ($_SERVER[‘HTTP_USER_AGENT’])) { $clientkeywords = array( ‘nokia’,’sony’,’ericsson’,’mot’,’samsung’,’htc’,’sgh’,’lg’,’sharp’,’sie-‘,’philips’,’panasonic’,’alcatel’,’lenovo’,’iphone’,’ipod’,’blackberry’,’meizu’,’android’,’netfront’,’symbian’,’ucweb’,’windowsce’,’palm’,’operamini’,’operamobi’,’openwave’,’nexusone’,’cldc’,’midp’,’wap’,’mobile’ ); //從HTTP_USER_AGENT中查找手機瀏覽器的關(guān)鍵字 if (preg_match(“/(” . implode(‘|’, $clientkeywords) . “)/i”, strtolower($_SERVER[‘HTTP_USER_AGENT’]))) { return true; } } //協(xié)議法,因為有可能不準確,放到最后判斷 if (isset ($_SERVER[‘HTTP_ACCEPT’])) { // 如果只支持wml并且不支持html那一定是移動設(shè)備 // 如果支持wml和html但是wml在html之前則是移動設(shè)備 if ((strpos($_SERVER[‘HTTP_ACCEPT’], ‘vnd.wap.wml’) !== false) && (strpos($_SERVER[‘HTTP_ACCEPT’], ‘text/html’) === false || (strpos($_SERVER[‘HTTP_ACCEPT’], ‘vnd.wap.wml’) < strpos($_SERVER[‘HTTP_ACCEPT’], ‘text/html’)))) { return true; } } return false; }
??? ?????: "thinkPHP ??? ????"
? ??? thinkphp? ??? ?? ?? ???? ??? ???????? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

ThinkPHP ????? ????? ??? ?????: Composer? ????, ???? ????? ???? php bin/console? ????, ?? ???? ??? http://localhost:8000? ?????.

ThinkPHP?? ??? PHP ????? ??? ?? ??? ????. ??? ???? 3.2, 5.0, 5.1, 6.0? ????, ??? ??? ??? ???? ??? ??? ???? ? ?????. ?? ?? ??? ThinkPHP 6.0.16???. ??? ??? ? PHP ??, ?? ?? ?? ? ???? ??? ??????. ??? ??? ??? ???? ?? ?? ??? ???? ?? ????.

ThinkPHP Framework? ???? ???? ??: ThinkPHP Framework? ?? ????? ?????? ??? ???. ThinkPHP ?? ????? ???? ?? ???(?? ??)? ????. ?????? ?? ????? ?????. ? ??? ?????. ThinkPHP ??????? ??????. ThinkPHP ?????? URL? ???? ?????.

Laravel? ThinkPHP ?????? ?? ??: ThinkPHP? ????? ??? ? ??? ??? ?? Laravel?? ??? ????. Laravel? ? ????? ??? ??????? ?? ThinkPHP? ? ??? ? ????.

ThinkPHP ?? ??: PHP, Composer ? MySQL ??? ?????. Composer? ???? ????? ????. ThinkPHP ?????? ???? ?????. ?????? ??? ?????. ?????? ??? ?????. ??????? ???? http://localhost:8000? ?????.

ThinkPHP? ?? ????, ?? ???, ?? ?? ? ?????? ???? ?? ??? ?? ??? PHP ????????. ?? ?? ???? ??? ?? 10,000? ??? ??? ??? ? ??? JD.com, Ctrip? ?? ??? ? ??? ? ?????? ????? ?? ?? ?????? ?? ?????.

?? ??: API ??? ?? ThinkPHP ?????? ???? ?? ???? ????? ????? API(?? ????? ?????)? ???? ?? ? ??? ????. API? ??? ??, ?? ?? ? ?? ??? ??? ? ??? ????? ??? ???? ?? ?? ??? ?????. ??? PHP ?? ?????? ThinkPHP ?????? ????? ?? ???? ???? ????.

"?? ??: ThinkPHP ?????? ???? ??? ??? ???? ??" ??? ??? ??? ???? ?? ? ?? ????? ?? ?? ?? ??? ??? ???? ??? ???? ?? ?? ??? ?? ? ??????. ??? ??? ??? ??? ????? ?? ???? ??? ???, ?? ??? ??, ??? ?? ?? ?? ??? ?? ??? ??? ???? ?? ??? ??? ???? ?? ?? ?????. PHP ???? ?? ???? ?? ?????? ThinkPHP ?????? ??? ??? ???? ? ?? ??? ??? ?????.
