Home >Backend Development >PHP Tutorial >ThinkPHP小白 POST无效,该怎么解决

ThinkPHP小白 POST无效,该怎么解决

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:45:411340browse

ThinkPHP小白 POST无效
根据POST的值来显示页面,但似乎获取不到POST的值:

<br />$username = $this->$_POST['username'];<br />//$name = $this->_post('name'); 换成这行业无效。<br />$user   =   M('user');<br />$data =   $user->where('username="'.$username.'"')->field('id,username')->find(); <br />if($data) {<br />	$this->success('成功');<br />}else{<br />	$this->error('失败');<br />}<br />


但是用_param方法就成功了。请高手解释一下。
------解决方案--------------------
你的post参数不是username吗?

$this->_post('name');当然无效,$this->_post('username');试下
------解决方案--------------------
楼主dump($_POST);试一下爱

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
Previous article:CAS是什么?Next article:yii框架在inux停报错。