0
這是一種基於URL包含頁面的可怕方式嗎? (使用mod_rewrite
通過index.php
)在PHP中包含基於URL的頁面
if($url === '/index.php/'.$user['username']) {
include('app/user/page.inc.php');
}
// Upload *
else if($url === '/index.php/'.$user['username'].'/Upload') {
include('app/user/upload.inc.php');
}
// Another page *
else if($url === '/index.php/AnotherPage') {
include('page/another_page.inc.php');
}
我使用$_GET['variables']
通過mod_rewrite
爲
^(.+)$ index.php?user=$1 [NC]
和其他幾個基地的網頁。但是,這些僅僅是基礎文件的第一個參數。上面的if/else例子也是區分大小寫的,這真的不好。
你對此有何看法?
我該如何mod_rewrite
這些2nd/3rd等參數關閉index.php
?
這是完全不符合上述例子的SEO嗎?
這包括運行此代碼的函數範圍內的文件。那是你要的嗎?請參見[PHP手冊](http://php.net/manual/en/function.include.php)中的示例2。 –