0
我希望這個網址:國防部重寫改變URL參數,但保留了get值
https://www.example.com/?image=3453245kjlkasdjflkjaslkdjfkw2.jpg
是這樣的:
https://www.example.com/img234
不使用數據庫,只需htaccess的和PHP。在PHP中,我想獲得原始的img字符串。 這可能嗎?
我希望這個網址:國防部重寫改變URL參數,但保留了get值
https://www.example.com/?image=3453245kjlkasdjflkjaslkdjfkw2.jpg
是這樣的:
https://www.example.com/img234
不使用數據庫,只需htaccess的和PHP。在PHP中,我想獲得原始的img字符串。 這可能嗎?
因此,建立一個基本的例子,而不框架使用,只需調用像水平
的.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /public
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9_]+)$ index.php
</IfModule>
#RewriteRule ^(.*)$ index.php/$1 [PT,L]
ErrorDocument 404 /index.php
的config.php
/**
*
* @rt_page get URI and splitted by levels
*
* @level_* is a part of URI
*/
$rt_page = explode("/",$_SERVER["REQUEST_URI"]);
$level_1 = $rt_page[1];
$level_2 = $rt_page[2];
$level_3 = $rt_page[3];
$level_4 = $rt_page[4];
$level_5 = $rt_page[5];
$level_6 = $rt_page[6];
$level_7 = $rt_page[7];
index.php
include_once(config.php);
echo $level_1; // Receive the first position
什麼IM這裏做的是劈裂的URI一樣的水平,並用這種方法,你可以打電話給你想要的東西。例如: