doujugu1722 2012-06-07 13:49
浏览 71
已采纳

Wordpress中的PHP $ _SERVER ['PHP_SELF']重定向到索引页面

I have a wordpress website. There is a category page with a form on it to sort / filter the posts.

I have tried using $_SERVER['PHP_SELF'] as the form action as i need to get the contents of the form to display the posts but when I do it redirects to the index page.

Is there a reason for this? Or a better way to submit a form within wordpress.

Thanks

  • 写回答

4条回答 默认 最新

  • doucang9673 2012-06-07 13:53
    关注

    The reason for this is that Wordpress runs (almost) everything through the index.php page and then handles which page to display via it's routing logic. You might try doing var_dump($_SERVER); to see which value you want but it's probably $_SERVER['REQUEST_URI'].

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?