dspx15491 2011-02-26 22:33
浏览 12
已采纳

这是在PHP中使用get的正确方法吗?

I'm using the below for get in php without a form.

If($q)
{
header("location:d.php?q=$name");
}

Is it correct?

  • 写回答

2条回答 默认 最新

  • duanma8207 2011-02-26 22:39
    关注

    According to the specification, the URI in the location header must be an absolute URI.

    But regardless of this, your code will create an (unnecessary?) redirect.

    If you want to persist values between requests, a better way would to use sessions.

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

报告相同问题?