How evil is $_REQUEST and what are some acceptable Band-Aid countermeasures?

前端 未结 4 1774
礼貌的吻别
礼貌的吻别 2020-12-30 10:50

I\'ve come across a couple of popular PHP-related answers recently that suggested using the superglobal $_REQUEST, which I think of as code smell, because it re

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-30 10:57

    $_REQUEST is problematic because it ignores the difference between URL ($_GET) and request body ($_POST). A HTTP-GET request should be without side-effects, while a HTTP-POST may have side-effects and thus can't be cached. Throwing these quite different data sources into one bucket, calls for applications that are un-REST-ful, which is to say bad applications.

提交回复
热议问题