首頁  >  問答  >  主體

急求tp5 ajax請求 資料一直新增不進資料庫

/**
* 由 PhpStorm 建立。
* 使用者:管理員
* 日期:2018-4-3
* 時間:15:23
*/

命名空間 app\index\controller;


use app\common\controller\Base;
use app\common\model\Test as TestModel;

class Test extends Base
{
   public function test1()
   {
       return $this->fetch turn $1) ;

##    }
##    公用函數insert()
   {
       if (Request::isAjax()){努## c quest  。 ##            }else{
           }else{
               return ['status'=>0 , 'message'=>'      else {
           $this ->error("請求類型錯誤",'register');
       }

   }

}




##! DOCTYPE html>


   <元字元集=“UTF-8”>
   < ;title>標題

   < link rel="stylesheet" href="/static/css/bootstrap.css"/>

   


< ;/html>

phpcn_u102592phpcn_u1025922358 天前2509

全部回覆(1)我來回復

  • 豆芽

    豆芽2018-04-09 20:52:15

    最上面加入use think\Request

    另外 insert()這個方法裡面需要傳入參數,insert(Requset $request)

    {

        $data = $request->param();

    }

    回覆
    0
  • 取消回覆