Question: The data has not been added to the database. Please give the management an answer. Thank you
#
{include file="public:header" /}
{include file="public:nav" /}
"
{include file="public:right" /}
{include file="public:footer" /}
namespace app\ index\controller;
use app\common\controller\Base;
use app\common\model\User as UserModel;
use think\facade\Request;
class User extends Base
{
public function register()
{
$this->assign('title','User registration');
return $this->fetch();
}
Processing the registration information submitted by the user
Public function insert()
{
//Use the model to create data
//Get the data submitted by the user through the form
if(Request::isAjax()){
$data = Request::except('password_confirm','post');
if(UserModel::create($data))
{
return ['status'=>1,'message'=>'Congratulations, registration is successful'];
return ['status'=> =>'Registration failed, please check'];
}
}else{
$this->error("Request type error",'register');
}
}
}
Question: The data has not been added to the database. Please give me the management answer. Thank you
Open the browser console to see what AJAX returns