2016-01-09 38 views
1

所以即时尝试重写我的网址。

我在IIS(godaddy.com)下 我使用web.config文件来编写我的规则。

所以现在我有基本的重写规则工作

<rewrite> 
    <rules> 
    <rule name="Rewrite to index.php"> 
     <match url="^article/([0-9]+)/([_0-9a-z-]+)" /> 
     <action type="Rewrite" url="index.php?id={R:1}&amp;title={R:2}" /> 
    </rule> 
    </rules> 
</rewrite> 

工作意味着,如果我的住址栏键入mydomain.com/article/2016/rewrite这是我重定向到index.php。

但是上一次的index.php我不能找回ID和标题值使用

$_POST['id']; 
$_POST['title']; 

$_GET是工作,但我怎么得到它与$_POST工作?

谢谢。

+0

$ _GET正在工作,但为什么$ _POST不工作?我宁愿发布内容然后获取它 – MadeInDreams

回答

1

URL中的数据放在$_GET中。如果您需要$_POST中的数据,则在发出请求时必须将其放入请求正文中。 URL重写不能在那里复制数据。