2012-07-12 98 views

回答

0

直到但不包括/$1,其余的在(.*)捕获到$2([^/]+)匹配一切的模式。

RewriteEngine On 
# Don't rewrite real existing files & directories (like css,js,img) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
# Add .php to the first group (like page.php) and stick the rest into p 
RewriteRule ^([^/]+)/(.*)$ $1.php?p=$2 

里面的PHP,检索通过的p值:

$_GET['p'] 
+0

感谢。稍后会尝试。希望这有效。 – user1497888 2012-07-12 03:31:27