<?php
/**
* ???: PhpStorm.
* ???: ???
* ??: 2018-4-3
* ??: 15:23
*/
namespace appindexcontroller;
use appcommoncontrollerBase;
use appcommonmodelTest as TestModel;
class ??? ?? Base
{
?? ?? test1()
{
return $ this->fetch();
}
?? ?? insert()
{
if (Request::isAjax()){
$data = Request::just('password_confirm','post');
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if(TestModel::create($data)){
? ? ? ? ? ? ? ?? ' ‐ ‐ ‐ ‐ ‐ ‐ ‐ ‐ return ['status'=>1, 'message'=>'?????, ?? ??????! ']; E} else {
Return [' ??' = & GT 0, '???' = & GT; '];
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> ??</title>
<link rel="stylesheet" href=" /static/css/bootstrap.css"/>
<script src="/static /js/bootstrap.js"></script>
</head>
<form class=" form-horizontal" method="post" id="testPost">
<div class="form-group">
" " <label for="inputEmail3" class="col-sm-2 control- label">???</label>
" " <div class="col-sm -10">
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?>;
? ?<div class="form-group">
? ? ? ?<label for="inputPassword3" class="col-sm-2 control-label">????</label>
? ? ? ?<div class="col -sm-10">
? ? ? ? ? ?<input type="password" name="password" class="form-control" id="inputPassword3" placeholder="Password">
? ? ? ?</div>
? ?</ div>
? ?<div class="form-group">
? ? ? ?<label for="inputPassword3" class="col-sm-2 control-label">Password</label>
? ? ? ?<div class=" col-sm-10">
? ? ? ? ? ?<input type="password" name="password_confirm" class="form-control" id="inputPassword4" placeholder="Password_confirm">
? ? ? ?</div>
? ?< /div>
? ?<div class="form-group">
? ? ? ?<div class="col-sm-offset-2 col-sm-10">
? ? ? ? ? ?<button type="submit" class= "btn btn-default" id="testButton">???</button>
? ? ? ?</div>
? ?</div>
</form>
<script>
$(function () {
$("#testButton").on('click',function () {
? ? ? ? ? ?$.ajax({
? ? ? ? ? ? ? ?type:'post',
url:"{:url('insert')}",
???: $ ('#testPost').serialize(),
dataType: 'json',
??: ??(???) {
? ? ? ? ? ? ? ? ? ?alert('成功了');
}
? ? ? ? ? ?})
? ? ? ?})
? ?})
</script>
</body>
</html>
??? thinkRequest ??? ?????
?? insert() ???? ????? ???? ???. insert(Requset $request)
{
? $data = $request->param();
}