zoukankan      html  css  js  c++  java
  • php 回调函数

    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;

        }

  • 相关阅读:
    bzoj2161 布娃娃
    bzoj2161 布娃娃
    Tyvj1054
    Tyvj1054
    Tyvj1053
    Tyvj1053
    hdu3265 Poster(扫描线)
    hdu3265 Poster(扫描线)
    hdu3265(好题翻译)
    hdu3265(好题翻译)
  • 原文地址:https://www.cnblogs.com/fx2008/p/3607332.html
Copyright © 2011-2022 走看看