我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

`if($ _ POST)`是否是检查脚本是否已发布的可靠方法?

As per the title: is if($_POST) reliable?

Is it reliably true even if no data was posted but the HTTP POST method was used?

Is if('post' === strtolower($_SERVER['REQUEST_METHOD'])) a more reliable method, or is it overkill?

No.. because:

array() == false

So if no data is posted, the condition will turn out false. So check against the REQUEST_METHOD. Note that it would have taken you less time to test this, than for me to type this out.

近期文章

  • Python实验1……
  • 0基础 学生,学什么语言好
  • vs运行qt工程,背景图片不能正常显示
  • matlab怎么返回数组的每一个元素
  • 微信开发者工具console.log打印不出来?
  • linux中如何查看文件命令
  • jupyter notebook 中 SPARK_HOME env没有正确被加载
  • el-upload动态改变上传文件地址
  • visual studio
  • Error:command failed:yarn 是什么原因?
  • ZendFramework - 我如何声明静态全局常量,以便在我的所有控制器和模型中都可以使用它?
  • GetWindowThreadProcessId参数传null
  • VMware上的VScode如何安装
  • 判断两个由大小写字母和空格组成的字符串在忽略大小写,且忽略空格后是否相等
  • request爬取时经常被封禁如何解决
  • 这种波浪函数的表达式怎么求
  • 如题怎么用forward跳转
  • ubuntu的ssh安装失败
  • vector容器使用中遇到的的问题
  • 为什么我这个代码就直接就结束了,没有什么东西

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华