未捕获的错误:在 /opt/lampp/htdocs/epos/catalog/controller/prerecorded/preDemo.php:43 中调用成员函数 preDemo1() 堆栈跟踪:#0 /opt/lampp/htdocs/epos/system/ engine/action.php(79): ControllerPrerecordedPreDemo->insertData() #1 /opt/lampp/htdocs/epos/catalog/controller/startup/router.php(25): Action->execute(Object(Registry)) # 2 /opt/lampp/htdocs/epos/system/engine/action.php(79): ControllerStartupRouter->index() #3 /opt/lampp/htdocs/epos/system/engine/router.php(67): 动作->execute(Object(Registry)) #4 /opt/lampp/htdocs/epos/system/engine/router.php(56): Router->execute(Object(Action)) #5 /opt/lampp/htdocs/ epos/system/framework.php(168): Router->dispatch(Object(Action), Object(Action)) #6 /opt/lampp/htdocs/epos/system/startup.php(104): require_once('/选择/lampp/htdo...') #7 /opt/lampp/htdocs/epos/index.php(19): start('catalog') #8 {main} 抛出 /opt/lampp/htdocs/epos/catalog/controller/prerecorded/preDemo.php在第 43 行
# 控制器public function insertData(){
// print_r($_POST);exit;
if($this->request->post['name'] && $this->request->post['email'] && $this->request->post['contactNumber'] && $this->request->post['businessType'] && $this->request->post['businessName'] && $this->request->post['role'] ) {
$data = array(
$name = $this->request->post['name'],
$email = $this->request->post['email'],
$contactNumber = $this->request->post['contactNumber'],
$businessType = $this->request->post['businessType'],
$businessName = $this->request->post['businessName'],
$role = $this->request->post['role']);
}
else {
$name = 0;
}
// echo "<pre>";print_r($data);
$this->load->model('prerecorded/preDemo');
$this->preDemo->preDemo1($data);
}
# 模型 ##########
<?php
class ModelPrerecordedPreDemo extends Model {
public function preDemo1($data) {
$this->db->insert("",$data);
}
}