当前位置:Gxlcms > PHP教程 > 用thinkphp写的会员登录总是报错,求解决

用thinkphp写的会员登录总是报错,求解决

时间:2021-07-01 10:21:17 帮助过:13人阅读

query("select * from developers where username="'.$POST['username'].'" and password="'.$_POST['password'].'"");				if($select){				    $_SESSION['admin']=$_POST['username'];					$this->redirect('Index/index','',2,'用户'.$_POST['username'].'登录成功!');                 }else{					$this->redirect('Index/index','',2,'用户名或者密码不正确');					}				}else{				    $this->redirect('Index/index','',2,'用户名或密码不能为空!');					}					}					$this->display();					}	    	}	?>


这个是在\app\lib\action目录下的AdminAction.class.php文件,然后运行它总是说
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in F:\AppServ\www\app\Lib\Action\AdminAction.class.php on line 9
:(
syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
错误位置
FILE: F:\AppServ\www\app\Lib\Action\AdminAction.class.php  LINE: 9


回复讨论(解决方案)

双引号里边还用双引号,另外还有单引号和链接符

username="'.$POST['username'].'"

username='{$POST['username']}'

and password="'.$_POST['password'].'"
??也要改

username="'.$POST['username'].'"

我去那个三个单引号在一起怎么打出来的?


username="'.$POST['username'].'"

我去那个三个单引号在一起怎么打出来的?

真愁人,神马三个单引号,是先单引号,再双引号。

username=\'".$POST['username']."\'

好吧 终于明白了

人气教程排行