What's wrong with using $_REQUEST[]?

后端 未结 16 1833
走了就别回头了
走了就别回头了 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:07

    GET requests should be idempotent and POST requests are generally not. This means that data in $_GET and $_POST should generally be used in different ways.

    If your application is using data from $_REQUEST, it will behave the same for both GET and POST requests, which violates the idempotence of GET.

提交回复
热议问题