What's wrong with using $_REQUEST[]?

后端 未结 16 1823
走了就别回头了
走了就别回头了 2020-11-22 03:53

I\'ve seen a number of posts on here saying not to use the $_REQUEST variable. I usually don\'t, but sometimes it\'s convenient. What\'s wrong with it?

16条回答
  •  情书的邮戳
    2020-11-22 04:18

    The only time using $_REQUEST is not a bad idea is with GET.

    • If you use it to load POST values, you risk cross-site request forgeries
    • If you use it to load cookie values, you again risk cross-site request forgeries

    And even with GET, $_GET is shorter to type than $_REQUEST ;)

提交回复
热议问题