×ðÁú¿­Ê±¹ÙÍøµÇ¼

thinkphpÔõÑù¹Ø±Õtraceµ÷ÊÔģʽ

ΪʲôҪ¹Ø±Õ trace ģʽ£¿

Trace ģʽÊÇ ThinkPHP ×Ô´øµÄµ÷ÊÔģʽ£¬¿ÉÒÔÔÚÒ³Ãæµ×²¿Àû±ãµØÉó²éÄ¿½ñÇëÇóµÄÏà¹ØÐÅÏ¢£¬ÈçÇëÇó²ÎÊý¡¢SQL Óï¾äµÈ£¬¶ÔÎÊÌⶨλºÜÊÇÓÐ×ÊÖú¡£However, in a production environment, we do not want these sensitive information to be leaked and thereby affect the system’s security.¡£±ðµÄ£¬µ÷ÊÔģʽ»¹»á´øÀ´Ò»¶¨µÄÐÔÄÜÏûºÄ£¬Òò´ËÎÒÃÇÓÐÐëÒª½«Æä¹Ø±Õ¡£

ÔõÑù¹Ø±Õ trace ģʽ£¿

ThinkPHP ĬÈÏÊÇ¿ªÆô trace ģʽµÄ£¬ÎÒÃÇ¿ÉÒÔͨ¹ýÉèÖà app_debug ²ÎÊýÀ´¹Ø±Õ trace ģʽ¡£

ÔÚ config Ŀ¼Ï嵀 app.php ÎļþÖУ¬ÎÒÃÇ¿ÉÒÔÕÒµ½ÒÔÏÂÉèÖãº

// ÊÇ·ñ¿ªÆôÓ¦Óõ÷ÊÔģʽ
'app_debug' => env('app_debug', true),

µÇ¼ºó¸´ÖÆ

½« app_debug µÄÖµÉèÖÃΪ false ¼´¿É¹Ø±Õ trace ģʽ£¬´úÂëÈçÏÂËùʾ£º

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

// ÊÇ·ñ¿ªÆôÓ¦Óõ÷ÊÔģʽ
'app_debug' => false,

µÇ¼ºó¸´ÖÆ

³ýÁËͨ¹ýÐÞ¸ÄÉèÖÃÎļþÀ´¹Ø±Õ trace ģʽ֮Í⣬ÎÒÃÇ»¹¿ÉÒÔÔÚÓ¦ÓóÌÐòµÄ¿ØÖÆÆ÷£¨Í¨³£ÊÇ»ù´¡¿ØÖÆÆ÷£©ÖÐÌí¼ÓÒÔÏÂÒªÁ죺

/**
 * ½á¹¹º¯Êý
 *
 * ¹Ø±Õµ÷ÊÔģʽ
 */
public function __construct()
{
    parent::__construct();

    // ¿ª·¢ÇéÐÎÏ£¬²»¹Ø±Õµ÷ÊÔ
    if (config('app_debug')) {
        return;
    }

    // ¹Ø±Õµ÷ÊÔ
    config('app_trace', false);
    config('app_debug', false);
}

µÇ¼ºó¸´ÖÆ

Õâ¸öÒªÌå»áÔÚ¿ØÖÆÆ÷³õʼ»¯Ê±±»Å²Óã¬ÈôÊÇ app_debug ÉèÖÃΪ false£¬Ôò»á¹Ø±Õ trace ģʽ¡£

ÒÔÉϾÍÊÇthinkphpÔõÑù¹Ø±Õtraceµ÷ÊÔģʽµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

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

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

QR code
ÍøÕ¾µØͼ