尊龙凯时人生就是博

thinkphp¹³×ÓÒªÁìÔÚÊÂÎñ´¦ÀíÖÐÔõôӦÓÃ

¹³×ÓÒªÁìÊÇÔ¤ÏȽç˵µÄº¯Êý£¬ÔÚÌض¨ÊÂÎñ±¬·¢Ê±×Ô¶¯Å²Óã¬ÔÚ¿ò¼ÜºÍÓ¦ÓóÌÐòÖÐÆÕ±éÓ¦Óá£ÕâЩÊÂÎñº­¸ÇÁËÖîÈçÓ¦ÓóÌÐòÆô¶¯¡¢ÇëÇóµÖ´ï¡¢¿ØÖÆÆ÷ÒªÁìŲÓÃÇ°ºó¡¢Ä£×ÓÊý¾Ý¸üÐÂÇ°ºóµÈÇéÐΡ£¿ª·¢Õß¿ÉÒÔÇáËɵØÌí¼Ó×Ô¼ºµÄÂß¼­£¬¶ø²»ÐèÒªÐÞ¸ÄÔ­ÓдúÂ룬ÕâÊÇͨ¹ýʹÓÃÕâЩ¹³×ÓÒªÁìʵÏֵġ£

ÏÂÃæÎÒÃÇÀ´¿´Ò»¸ö¼òÆÓµÄÀý×Ó¡£¼ÙÉèÎÒÃÇÓÐÒ»¸ö¿ØÖÆÆ÷£¬ËüÐèÒªÔÚŲÓÃÒªÁì֮ǰ×öһЩ׼±¸ÊÂÇé¡£ÔÚ¿ØÖÆÆ÷ÀàÖУ¬ÎÒÃÇ¿ÉÒÔ½ç˵һ¸öÃûΪ¡°before¡±µÄÒªÁ죬Ȼºó½«Æä×¢²áµ½¡°app_init¡±ÊÂÎñÉÏ£¬Ê¾ÀýÈçÏ£º

<?php

namespace app\index\controller;

use think\Controller;

class Index extends Controller
{
    protected function before()
    {
        // ×¼±¸ÊÂÇé
    }

    public function index()
    {
        // Ö÷ÒªÁì
        return $this->fetch();
    }
}

µÇ¼ºó¸´ÖÆ

ÔÚÓ¦ÓóÌÐòÆô¶¯Ê±£¬¿ò¼Ü»á×Ô¶¯Å²ÓÃbeforeÒªÁì¡£ÕâÑù£¬ÎÒÃǾͿÉÒÔÔÚ´¦ÀíÇëÇó֮ǰִÐÐ×Ô¼ºµÄÂß¼­¡£

³ýÁË×¢²á¿ò¼Ü½ç˵µÄÊÂÎñÖ®Í⣬ÎÒÃÇ»¹¿ÉÒÔÔÚÓ¦ÓóÌÐòÖнç˵×Ô¼ºµÄÊÂÎñ¡£¼ÙÉèÎÒÃÇÓÐÒ»¸öÐèÒªÔÚÊÂÎñ´¦ÀíʱִÐеÄÂß¼­¡£ÎÒÃÇ¿ÉÒÔ½ç˵һ¸öÃûΪ¡°transaction¡±µÄÊÂÎñ£¬²¢½«Æä×¢²áµ½¡°commit¡±ÊÂÎñÖУ¨µ±ÊÂÎñÌύʱ×Ô¶¯Ö´ÐУ©¡£´úÂëÈçÏÂËùʾ£º

Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»

<?php

namespace app\index\model;

use think\Model;

class User extends Model
{
    protected function initialize()
    {
        $this->registerEvent('transaction', function() {
            // ÊÂÎñ´¦ÀíÂß¼­
        });
    }
}

µÇ¼ºó¸´ÖÆ

initializeÊÇÔÚÄ£×ÓÀà³õʼ»¯Ê±×Ô¶¯Å²ÓõÄÒªÁ죬ÎÒÃÇ¿ÉÒÔÔÚÆäÖнç˵ÊÂÎñ´¦Àíº¯Êý¡£

ÎÒÃÇÒѾ­°ÑÒ»¸öÃûΪ¡°transaction¡±µÄÊÂÎñ½ç˵ºÃ²¢×¢²áµ½ÁËÄ£×ÓÀàÖС£ÎÒÃÇÖ»ÐèÒªÔÚÊÂÎñ´¦ÀíʱŲÓÃ$this->fireEvent(‘transaction’)¼´¿É´¥·¢¸ÃÊÂÎñ¡£

ÒÔÉϾÍÊÇthinkphp¹³×ÓÒªÁìÔÚÊÂÎñ´¦ÀíÖÐÔõôӦÓõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ