我刚写了一个htaccess文件和一个简单的规则.
RewriteRule ^/?([a-z]{2})/([0-9]{4})/?$ /run/run.php?country=$1&year=$2 [NC,L]
This does http://www.localhost/us/2014
Run Code Online (Sandbox Code Playgroud)
在php页面上,我意外地做了:
echo $country.' '.$year;
Run Code Online (Sandbox Code Playgroud)
这给了我下面的输出,这是正确的.
us 2014
Run Code Online (Sandbox Code Playgroud)
我没有做:
$country = $_GET['country'];
$year = $_GET['year'];
Run Code Online (Sandbox Code Playgroud)
但它仍然奏效.这是正常的行为吗?我可以将此用于其他规则和网站吗?我在Windows 7 Home Premium上使用WAMP.
| 归档时间: |
|
| 查看次数: |
177 次 |
| 最近记录: |