Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
タイトルの通り:if($_POST)信頼できますか?
if($_POST)
trueデータを投稿せずに HTTP POST メソッドを使用しても確実ですか?
true
より信頼性の高い方法ですかif('post' === strtolower($_SERVER['REQUEST_METHOD']))、それともやり過ぎですか?
if('post' === strtolower($_SERVER['REQUEST_METHOD']))
いいえ。理由:
array()== false
したがって、データが投稿されていない場合、条件はfalseになります。したがって、REQUEST_METHODと照合してください。これを入力するよりも、これをテストする方が時間がかからないことに注意してください。