判断$_post的值

WBOY
Release: 2016-06-23 13:30:58
Original
1350 people have browsed it

1.$_post的值如何判断?

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


上面的写法对吗?


回复讨论(解决方案)

if(isset($_POST["username"]) && $_POST["username"] == '') {  echo"kong";}elseif(isset($_POST["username"]) && $_POST["username"] != "admin") {  echo"kong";}
Copy after login
Copy after login

if (isset($_POST['username']) && (empty($_POST['username']) || $_POST['username'] !== 'admin')) {    echo 'kong';//空或不等于admin} elseif (isset($_POST['username']) && $_POST["username"] == 'admin') {    echo "yes";//管理员}
Copy after login
Copy after login

if(isset($_POST["username"]) && $_POST["username"] == '') {  echo"kong";}elseif(isset($_POST["username"]) && $_POST["username"] != "admin") {  echo"kong";}
Copy after login
Copy after login


if(!isset($_POST["username"]) && $_POST["username"] == '')
多谢!

if (isset($_POST['username']) && (empty($_POST['username']) || $_POST['username'] !== 'admin')) {    echo 'kong';//空或不等于admin} elseif (isset($_POST['username']) && $_POST["username"] == 'admin') {    echo "yes";//管理员}
Copy after login
Copy after login


判断非空还可以用empty来。。。学习了!
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template