mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
支持关闭伪静态访问 设置url_html_suffix 为false
This commit is contained in:
@@ -349,8 +349,18 @@ class Request
|
|||||||
public function path()
|
public function path()
|
||||||
{
|
{
|
||||||
if (is_null($this->path)) {
|
if (is_null($this->path)) {
|
||||||
// 去除正常的URL后缀
|
$suffix = Config::get('url_html_suffix');
|
||||||
$this->path = preg_replace(Config::get('url_html_suffix') ? '/\.(' . trim(Config::get('url_html_suffix'), '.') . ')$/i' : '/\.' . $this->ext() . '$/i', '', $this->pathinfo());
|
$pathinfo = $this->pathinfo();
|
||||||
|
if(false === $suffix){
|
||||||
|
// 禁止伪静态访问
|
||||||
|
$this->path = $pathinfo;
|
||||||
|
}elseif($suffix){
|
||||||
|
// 去除正常的URL后缀
|
||||||
|
$this->path = preg_replace('/\.(' . ltrim($suffix, '.') . ')$/i' , '', $pathinfo);
|
||||||
|
}else{
|
||||||
|
// 允许任何后缀访问
|
||||||
|
$this->path = preg_replace('/\.' . $this->ext() . '$/i', '', $pathinfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $this->path;
|
return $this->path;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user