Home > Backend Development > PHP Tutorial > 菜鸟PHP $_SESSION['liuyanyzm']!==$_POST['yzm']比较时出错了

菜鸟PHP $_SESSION['liuyanyzm']!==$_POST['yzm']比较时出错了

WBOY
Release: 2016-06-13 13:17:16
Original
1132 people have browsed it

初学者PHP $_SESSION['liuyanyzm']!==$_POST['yzm']比较时出错了
echo "session:".$_SESSION['liuyanyzm'].'
';
echo "表单:".$_POST['yzm'];
if(isset($_POST['submit']) and $_POST['submit']=="提交"){
if($_SESSION['liuyanyzm']!==$_POST['yzm']){
echo '';
}
}
?>
搞不明白为什么$_SESSION['liuyanyzm']和$_POST['yzm']都能打印出来,但是为什么比较都是false呢?各位帮我看看,谢谢了!(初学者)

------解决方案--------------------
var_dump($_SESSION['liuyanyzm'], $_POST['yzm']);
贴出结果
------解决方案--------------------
显示页面与处理页面分开
------解决方案--------------------
没有看到 $_SESSION['liuyanyzm'] 在哪里赋值的
------解决方案--------------------
$_SESSION['liuyanyzm']和$_POST['yzm']类型不同,一个是int,一个string,所以肯定是false
改成这样试试
if($_SESSION['liuyanyzm']!=$_POST['yzm'])

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