亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

PHP獲取數(shù)據(jù)庫表中的數(shù)據(jù)插入新的表再原刪除數(shù)據(jù)方法

 更新時(shí)間:2018年10月12日 10:58:49   投稿:laozhang  
在本篇文章中我們給大家分享了關(guān)于PHP獲取要?jiǎng)h除數(shù)據(jù)庫表中的數(shù)據(jù)插入新的表再原刪除數(shù)據(jù)的詳細(xì)方法和相關(guān)代碼,需要的朋友們參考下。

1, 路由 我使用 get

(1) 控制器

public function a(Request $request){
    //獲取指定的id
    $id = $request->id;
    $rs=R::find($id);
    //倉庫中
    $re=$rs->rfid;
    //判斷倉庫中的是否與數(shù)據(jù)庫的rf在線的是否相等
    $ws= G::where('rfid','=',$re)->first();
    if($ws){
      return response()->json(['status'=>0,'msg'=>'不成功']);
    }
    //導(dǎo)入數(shù)據(jù)
    $sql=DB::insert("insert into gs( g ,id,created_at,updated_at) values (?,?,?,?)",
      [$rs->p,$rs->r,$rs->creat,$rs->up]);
//    成功刪除
    if($sql){
      $rs->delete();
      return ['status'=>1,'msg'=>'成功'];
    }else{
      return response()->json(['status'=>0,'msg'=>'不成功']);
    }

(2) view

<span class="change" data-id="{{id}}" >關(guān)聯(lián)</span>

(3)js 注意

layer插件

<script>
  $(".change").click(function () {
    var id = $(this).data("id");
    if(confirm("確定xxx")){
      $.ajax({
        url: '/',
        type: 'get',
        data: {'id':id},
        success: function (res) {
          if (res.status == 0) {
            layer.msg(res.msg);
          } else {
            layer.msg(res.msg, {icon: 1}, function () {
              location.href = '要跳轉(zhuǎn)的頁面';
            });
          }
        }
      });
    }
  });

以上就是本次的全部?jī)?nèi)容知識(shí)點(diǎn),感謝大家對(duì)腳本之家的支持。

相關(guān)文章

最新評(píng)論