头像

PHP强制URL地址栏后缀html thinkphp网页地址URL限制html

来源:https://www.sucaihuo.com/topic/2349.html 素材火管理员 2021-01-15 09:52浏览(30)

PHP强制URL.html

$REQUEST_URI = $_SERVER["REQUEST_URI"];//获取URL结尾
if (!strstr($REQUEST_URI, \\\'.html\\\')) { //判断URL是否包含.html
$URL_CURRENT = $_SERVER ["REQUEST_SCHEME"] . \\\'://\\\' . $_SERVER ["SERVER_NAME"] . $REQUEST_URI;//获取完整URL
$URL_ARR = explode(".", $REQUEST_URI);
$URL_SUFFIX = $URL_ARR[1];

if ($URL_SUFFIX) { //判断是否有后缀
$URL_REPLACE = str_replace($URL_SUFFIX, "html", $URL_CURRENT);//替换字符串
} else { //若是后缀为字符串或者NULL
if (gettype($URL_SUFFIX) == \\\'string\\\') {
$URL_REPLACE = $URL_CURRENT . "html";
} else {
$URL_REPLACE = $URL_CURRENT . ".html";
}
}
header("Location:" . $URL_REPLACE . "");
}


Thinkphp强制URL html

\\\'source/:id\\\'=>array(\\\'source/detail\\\',\\\'status=1&app_id=5\\\',array(\\\'ext\\\'=>\\\'html\\\')),


评论0
头像

系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791

1 2