thinkphp 字段映射有关问题

WBOY
Release: 2016-06-13 12:00:02
Original
994 people have browsed it

thinkphp 字段映射问题
class ProjectAction extends Action{
protected $_map = array(
                                   'username' => 'user', // 把表单中 username 映射刡数据表的user 字段
                                   'password' => 'pwd',// 把表单中的password 映射刡数据表的pwd 字段
);

public function insert(){
$Project = D('Project');
if ($Project->create()){
echo "创建数据对象成功!";
if($Project->add()){
echo '添加数据成功';
}else {
echo '添加数据失败';
}
}else{
echo '创建数据对象失败';
}

}

}

将表单数据插入数据表里,执行insert函数时,数据对象创建失败,请问大家问题出在哪里?
------解决方案--------------------
贴出 Model  Project文件内容

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