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

ThinkPHP小白 POST无效,该如何解决

WBOY
Release: 2016-06-13 11:17:59
Original
897 people have browsed it

ThinkPHP小白 POST无效

本帖最后由 bluicezhen 于 2013-03-18 22:38:39 编辑 根据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 />
Copy after login


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

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