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

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

Jun 13, 2016 pm 01:17 PM
post quot session

初学者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'])

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to set session timeout in SpringBoot Session How to set session timeout in SpringBoot Session May 15, 2023 pm 02:37 PM

How to set session timeout in SpringBoot Session

How to solve session failure How to solve session failure Oct 18, 2023 pm 05:19 PM

How to solve session failure

Solution to PHP Session cross-domain problem Solution to PHP Session cross-domain problem Oct 12, 2023 pm 03:00 PM

Solution to PHP Session cross-domain problem

What should I do if the php session disappears after refreshing? What should I do if the php session disappears after refreshing? Jan 18, 2023 pm 01:39 PM

What should I do if the php session disappears after refreshing?

A brief analysis of the POST method in PHP with parameters to jump to the page A brief analysis of the POST method in PHP with parameters to jump to the page Mar 23, 2023 am 09:15 AM

A brief analysis of the POST method in PHP with parameters to jump to the page

How to implement SMS login in Redis shared session application How to implement SMS login in Redis shared session application Jun 03, 2023 pm 03:11 PM

How to implement SMS login in Redis shared session application

How to correctly read and write Session data in multiple files with PHP How to correctly read and write Session data in multiple files with PHP Mar 23, 2023 am 11:12 AM

How to correctly read and write Session data in multiple files with PHP

How to determine whether a post has been submitted in PHP How to determine whether a post has been submitted in PHP Mar 21, 2023 pm 07:12 PM

How to determine whether a post has been submitted in PHP

See all articles