thinkPHP删除前弹出确认框的简单实现方法,thinkphp弹出
本文实例讲述了thinkPHP删除前弹出确认框的简单实现方法。分享给大家供大家参考,具体如下:
html部分:
复制代码 代码如下:删除
javascript部分:
<script> function del() { if(confirm("确定要删除吗?")) { return true; } else { return false; } } </script>
控制器部分:
public function shanchu() { $id=$this->_request('id'); if($id) { $user=M('user'); $data['id']=$id; $rs=$user->where($data)->delete(); if($rs) { $this->success('删除成功!'); } else { $this->error('删除失败!'); } } else { $this->error('删除失败!'); } }
补充:小编在这里推荐一款本站的php格式化美化的排版工具帮助大家在以后的PHP程序设计中进行代码排版:
php代码在线格式化美化工具:http://tools.jb51.net/code/phpformat
更多关于thinkPHP相关内容感兴趣的读者可查看本站专题:《ThinkPHP入门教程》、《ThinkPHP常用方法总结》、《smarty模板入门基础教程》及《PHP模板技术总结》。
希望本文所述对大家基于ThinkPHP框架的PHP程序设计有所帮助。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver Mac version
Visual web development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft