日期:2014-05-17  浏览次数:20397 次

ThinkPHP小白 POST无效
本帖最后由 bluicezhen 于 2013-03-18 22:38:39 编辑
根据POST的值来显示页面,但似乎获取不到POST的值:

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


但是用_param方法就成功了。请高手解释一下。
thinkphp?post php

------解决方案--------------------
你的post参数不是username吗?

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