我从网上下载了这个模板,很容易理解。它用于检测您正在使用的设备以及所有设备。好吧,我遇到的一个问题是 index.php 页面是如何设置的,它使用 REQUEST_URI 来确定当您单击它时它需要拉出一个问题链接它移动文件而不是在索引上.php 现在位于 foobar.php 上,导致 REQUEST_URI 无用。当您单击链接时,我觉得它试图留在 index.php 页面上,但它仍然显示它应该遵循的目录。我不确定,但这里有两个文件。对不起,我的解释很糟糕......语法等等从来都不是我的强项。
哦耶。然而,我确实取出了他们的检测并将其替换为移动检测(我发现它更好并且更新了),但是当我使用他们的时它仍然会给我这个问题。
配置文件
<?php
/*
* A Design by W3layouts
Author: W3layouts
Author URL: http://w3layouts.com
License: Creative Commons Attribution 3.0 Unported
License URL: http://creativecommons.org/licenses/by/3.0/
*
*/
$current_page_uri = $_SERVER['REQUEST_URI'];
$part_url = explode("/", $current_page_uri);
$page_name = end($part_url);
echo $current_page_uri;
echo $page_name;
$email_id = "w3layouts@gmail.com";
?>
索引.php
<?php
/*
* A Design by W3layouts
Author: W3layouts
Author URL: http://w3layouts.com
License: Creative Commons Attribution 3.0 Unported
License URL: http://creativecommons.org/licenses/by/3.0/
*
*/
/*
include "app/config.php";
include "app/detect.php";*/
include "app/config.php";
require_once 'app/Mobile_Detect.php';
$detect = new Mobile_Detect;
$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
$scriptVersion = $detect->getScriptVersion();
if ($deviceType == "tablet" || $deviceType == "phone") {
$browser_t = "smartphone";
}
elseif ($deviceType == "computer") {
$browser_t = "web";
}
if ($page_name=='') {
include $browser_t.'/index.html';
}
elseif ($page_name=='index.html') {
include $browser_t.'/index.html';
}
elseif ($page_name=='technology.html') {
include $browser_t.'/technology.html';
}
elseif ($page_name=='blog.html') {
include $browser_t.'/blog.html';
}
elseif ($page_name=='about.html') {
include $browser_t.'/about.html';
}
elseif ($page_name=='contact.html') {
include $browser_t.'/contact.html';
}
elseif ($page_name=='single-page.html') {
include $browser_t.'/single-page.html';
}
elseif ($page_name=='404.html') {
include $browser_t.'/404.html';
}
elseif ($page_name=='contact-post.html') {
include 'app/contact.php';
}
else
{
include $browser_t.'/404.html';
}
?>