所以我试图重写我的url。
我在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}&title={R:2}" />
</rule>
</rules>
</rewrite>
工作意味着,如果我在地址栏中键入mydomain.com/article/2016/rewrite,它会将我重定向到index.php。
然而,一旦在index.php上,我就无法使用检索id和title的值
$_POST['id'];
$_POST['title'];
$_GET
正在工作,但我如何使它与$_POST
一起工作?
谢谢。
URL中的数据被放置在$_GET
中。如果您想要$_POST
中的数据,那么在发出请求时必须将其放在请求体中。URL重写无法在那里复制数据。