{include file="public: nav" /}
&"> Urgent request for tp5 ajax request. Data cannot be added to the database.-PHP Chinese Network Q&A
Urgent request for tp5 ajax request. Data cannot be added to the database.
一米阳光
一米阳光 2019-01-06 00:14:39
0
2
1179

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

一米阳光
一米阳光

reply all (1)
秋香姐家的小书童

Open the browser console to see what AJAX returns

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!