我想知道如何在这样的 href 元素上缩短标签的路径。
<a href="?action=read-more" target="_blank"><button type="submit" target="_blank" class="moreButton">Read more>></button></a>
此标签将链接重定向到 readMore.php 文件。
是否有人知道如何编写代码,并提供一些我可以学习的示例链接。如果我将实际路径放在某人将右键单击浏览器并可以看到下面的代码库。我想隐藏的目的是为我的 php 文件创建一个假路径。非常感谢。
答案 0 :(得分:1)
我建议使用像 this 这样的路由器。
Bramus/router
// This route handling function will only be executed when visiting
// http(s)://www.example.org/route/{One or more digits (0-9)}
$router->get('/route/(\d+)', function($routeID) {
if( $routeID == 1 ) {
header("Location: http(s)://www.example.org/readMore.php");
exit();
}
elseif( $routeID == 2 ) {
header("Location: http(s)://www.example.org/any.php");
exit();
}
else{
header("Location: http(s)://www.example.org/404.php");
exit();
}
});
URL
的示例 readMore.php
https://www.example.org/route/1
重定向到 https://www.example.org/readMore.php