Home >Backend Development >PHP Tutorial >判断$_post的值,该如何解决

判断$_post的值,该如何解决

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:22:501121browse

判断$_post的值
1.$_post的值如何判断?

if(isset($_POST["username"])=""){echo"kong";}elseif(isset($_POST["username"])!="admin"){echo"kong";}


上面的写法对吗?
------解决思路----------------------
if(isset($_POST["username"]) && $_POST["username"] == '') {<br />  echo"kong";<br />}elseif(isset($_POST["username"]) && $_POST["username"] != "admin") {<br />  echo"kong";<br />}

------解决思路----------------------
<br />if (isset($_POST['username']) && (empty($_POST['username']) <br><font color='#FF8000'>------解决思路----------------------</font><br> $_POST['username'] !== 'admin')) {<br />    echo 'kong';//空或不等于admin<br />} elseif (isset($_POST['username']) && $_POST["username"] == 'admin') {<br />    echo "yes";//管理员<br />}<br /><br />

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