action
优质
小牛编辑
132浏览
2023-12-01
Action(事务)
启动一个事务
action( $callback )$callback [function]
事务内执行的方法.
$database->action(function($database) { $database->insert("account", [ "name" => "foo", "email" => "bar@abc.com" ]); $database->delete("account", [ "user_id" => 2312 ]); // If you want to find something wrong, just return false to rollback the whole transaction. if ($database->has("post", ["user_id" => 2312])) { return false; }});