【发布时间】:2017-05-17 05:39:30
【问题描述】:
我试图在其他网站上查找是否有办法在我的 PHP 页面中将 ?p=page 替换为 /page。我想从http://localhost/tapromtour.com/?p=tour_discovery 更改为http://localhost/tapromtour.com/tour_discovery。我主页中的代码如下:
<?php
if (isset($_GET["p"])){
$ext =".php";
$file_name = $_GET["p"];
$file = "view/".$file_name.$ext;
if (file_exists($file)){
include $file;
}else{
echo 'no file found';
}
}else{
echo '<meta http-equiv="refresh" content="0; url=?p=home">';
}
?>
我使用此代码从一个页面链接到另一个页面。有什么方法可以从"localhost/tapromtour.com/?p=tour_discovery" 更改为"localhost/tapromtour.com/tour_discovery"? 如果有请帮助告诉我该怎么做。谢谢
http://localhost/tapromtour.com/?p=tour_discovery
http://localhost/tapromtour.com/tour_discovery
【问题讨论】:
-
使用
.htaccess -
你能告诉我如何使用它吗?
-
google .htaccess -> 尝试 -> 失败 -> 询问失败
-
我知道你想做什么,但你的方法不对。