求大神支招
就是移動跟pc同屬一個URL 后面不帶html的那種
uj5u.com熱心網友回復:
框架好像是獲取螢屏的寬度判斷的。然后,你獲取一下瀏覽器的資訊,看看能不能從里面找到相關的東西uj5u.com熱心網友回復:
那你就判斷下使用的系統 如果是pc你就打開一個內容,如果是android或者ios 你就打開另外一個uj5u.com熱心網友回復:
通過URL,傳遞不同的引數,判斷來自于pc還是移動,分別導向到不同的頁面,同頁面的話自適應不好搞,美觀度達不到uj5u.com熱心網友回復:
最簡單的辦法是寫兩種樣式,然后獲取螢屏的大小來判斷用哪一套。uj5u.com熱心網友回復:
4摟正解; 做自適應, 同一頁面訪問出來的內容就可以做到不一樣uj5u.com熱心網友回復:
css控制!顯示/隱藏。我就是這樣搞的uj5u.com熱心網友回復:
apache2 kttpd.conf修改為:<IfModule dir_module>index.php為:
DirectoryIndex index.php index.html index.html index.asp
</IfModule>
<?php請求地址如:http://127.0.0.1/
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'
);
if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) {
/*方法一: 移動端讀入檔案:
$file_path = "index_mb.html";
if (file_exists($file_path)) {
$str = file_get_contents($file_path);
echo $str;
}
方法二: 直接輸出:*/
echo '
<!DOCTYPE html>
<html>
<head>
<title> </title>
</head>
<body>
<span>移動端頁面</span>
</body>
</html>
';
} else {
/* 方法一: PC端讀入檔案:
$file_path = "index.html";
if (file_exists($file_path)) {
$str = file_get_contents($file_path);
echo $str;
}
方法二: 直接輸出:*/
echo '
<!DOCTYPE html>
<html>
<head>
<title> </title>
</head>
<body>
<span>PC端頁面</span>
</body>
</html>
';
}
} else {
//echo '未知客戶端';
}
?>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/111187.html
標籤:IIS
上一篇:任務調度如何學習
下一篇:前端網頁
