Thinkphp code instance to implement bulk delete data _php tutorial

Source: Internet
Author: User
thinkphp implementation of Bulk Delete data principle is very simple, just on the template page to write This is an array, and the action's delete function del () is as follows:

/**** Delete function supports deleting multiple and one **/function del () {  //dump ($_get[' id '));  $name = Strtolower ($_get[' _url_ '][0]); Gets the current module name  $name = $this->getactionname ();  $model = D ($name);//Gets the operand of the current module  $id = $_get[' id '];  Determines whether the ID is an array or a numeric  if (Is_array ($id)) {    $where = ' id in ('. Implode (', ', $id) ') ';  } else{    $where = ' id= '. $id;  }  Dump ($where);  $list = $model->where ($where)->delete ();  if ($list!==false) {    $this->success ("successfully deleted {$list} bar! ");  } else{    $this->error (' Delete failed! ');  }}

http://www.bkjia.com/PHPjc/824660.html www.bkjia.com true http://www.bkjia.com/PHPjc/824660.html techarticle thinkphp Implementation of the bulk delete data principle is very simple, simply write input name= ' id[] ' type= ' checkbox ' value= ' {$vo. ID} ' class= ' in the template page This is an array ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.