【发布时间】:2011-02-09 07:42:29
【问题描述】:
我在修复我的网站上的 URL http://www.abelputra.com 时遇到问题:我想将 www.abelputra.com/software.php 更改为 www.abelputra.com/software。
我已经阅读了一个建议如下的教程:
对于.htaccess:
RewriteEngine On
RewriteRule ^ ([a-zA-Z0-9_-] +) $ index.php? Key = $ 1
RewriteRule ^ ([a-zA-Z0-9_-]+)/$ index.php? Key = $ 1
然后在php中:
index.php --->
$Key=$ _GET ['key'];
if ($key == 'home')
{
include ('index.php'); // Home page
}
else if ($ key == 'software')
{
include ('software.php'); //
}
else if ($ key == 'webdesign')
{
include ('webdesign.php'); //
}
问题是当我用software.php和index.php实现菜单调用页面时:
www.abelputra.com/index.php?key=software
显示的页面是两个页面,下面是 software.php 和 index.php 页面。
是因为我在调用“include()”函数吗?
index.php 结构:
标题
内容 -> 包含开头词
页脚
software.php 结构:
标题
内容 -> 包含对我的软件的说明
页脚
【问题讨论】: