php 回调函数
PHP 函数 回调
2023-09-11 14:20:18 时间
publicfunction transaction(Closure $callback)
{
$this->beginTransaction();
// We'll simply execute the given callback within a try / catch block
// and if we catch any exception we can rollback the transaction
// so that none of the changes are persisted to the database.
try
{
$result = $callback($this);
$this->commit();
}
// If we catch an exception, we will roll back so nothing gets messed
// up in the database. Then we'll re-throw the exception so it can
// be handled how the developer sees fit for their applications.
catch(\Exception $e)
{
$this->rollBack();
throw $e;
}
相关文章
- PHP格式化金钱函数
- php:PHP解析xml的4种方法
- php闭包函数简析
- PHP 长文章分页函数
- php分享三十:php版本选择
- js与php中一些相似函数的对比
- php保存快捷方式到桌面
- php友好格式化时间
- PHP第一天学习笔记
- Sublime Text 3 php插件
- 把字符串解析到变量,数组变量中的函数 PHP parse_str() 函数
- PHP mysql_num_rows() 函数 返回结果集中行的数目。
- PHP很有用的一个函数ignore_user_abort ()
- Docker Dockefile制作nginx php镜像搭建Wordpress网站
- PHP发送邮件函数sendmail()
- PHP Libxml 函数
- PHP date() 函数
- PHP面试题:php读取文件内容的几种方法和函数?
- php 注册器模式 工厂模式
- php+nginx 整合
- docker 安装php
- 4种PHP回调函数风格