Home >php教程 >php手册 >php提交表单时判断 if($_POST[submit])与 if(isset($_POST[submit])) 的区别

php提交表单时判断 if($_POST[submit])与 if(isset($_POST[submit])) 的区别

WBOY
WBOYOriginal
2016-06-13 12:11:34880browse

应该这样用if(isset($_POST['submit'])) {
}
提交表单时 if($_POST[submit])与 if(isset($_POST[submit])) 的区别

第一种方法会出现一个warning,第二种相对更严谨。
还有就是POST的键名最好加上单引号,这样效率稍微高点(大概3-4倍)。
恩 差不多那个意思,如果设置了这个变量则返回true

PHP中if(isset($_POST['Submit']))是什么意思
isset -- 检测变量是否设置

判断post过来的数据是否被提交过来

复制代码 代码如下:


if(isset($_POST["submit"]){
echo "提交过来了";
}else
{
echo "submit is no come~";
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn