thinkphp5ÔõÑù¹Ø±ÕinfoÐÅÏ¢Êä³ö
Ò»¡¢info µÄ×÷ÓÃ
ÔÚ×îÏÈ¹Ø±Õ info ֮ǰ£¬ÎÒÃÇÐèÒªÏàʶһÏÂËüµÄ×÷Óá£ÔÚ ThinkPHP5 ¿ò¼ÜÖУ¬info ÐÅÏ¢Êä³öÖ÷ÒªÓÐÈýÖÖÐÎʽ£º
չʾĿ½ñ»á¼ûµÄ URL ºÍÇëÇó²ÎÊý
ÔÚÒ³Ãæµ×²¿Õ¹Ê¾Ä¿½ñÒ³ÃæµÄ SQL Óï¾äÖ´ÐÐÇéÐκÍÔËÐÐʱ¼äµÈµ÷ÊÔÐÅÏ¢
Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
ÔÚÖ´Ðйýʧʱ£¬Êä³öÏêϸµÄ¹ýʧÐÅÏ¢£¬Àû±ãµ÷ÊÔ
Ö»¹Ü¿´ÆðÀ´ºÜÓÐ×ÊÖú£¬µ«¹ØÓÚÕæÕýµÄ¿ª·¢ÕßÀ´Ëµ£¬´ó²¿·Ö info ÐÅÏ¢²¢²»ÊǺÜÊÇÊÊÓõġ£Í¨³££¬ÎÒÃÇÐèÒªµÄÊÇһЩ¸ü¾«Á·µÄÊä³ö£¬ÒÔ±ã¸üºÃµØרעÓÚ¿ª·¢¡£
¶þ¡¢¹Ø±Õ info
¹Ø±Õ info ºÜ¼òÆÓ£¬Ö»ÐèÒªÔÚÉèÖÃÎļþÖÐµÄ app.php ÖУ¬½« app_debug ÉèÖÃÏîÉèÖÃΪ false ¼´¿É¹Ø±Õ info ÐÅÏ¢Êä³ö¡£Ê¾Àý´úÂëÈçÏ£º
return [ 'app_debug' => false ];
µÇ¼ºó¸´ÖÆ
ÕâÑùÉèÖÃÖ®ºó£¬Ä¬ÈÏÇéÐÎÏ£¬Ò³Ã潫²»ÔÙչʾĿ½ñµÄ URL ºÍÇëÇó²ÎÊý£¬Ò²²»»áÊä³ö SQL Óï¾äÖ´ÐÐÇéÐκ͹ýʧÐÅÏ¢¡£ËäÈ»£¬ÈôÊÇÄúÐèÒª£¬Äú¿ÉÒÔÔÚ¿ò¼ÜµÄµ÷ÊÔģʽÏÂÖØпªÆô info¡£
ÁíÍ⣬ÈôÊÇÄúÐèÒªÔÚ¿ª·¢Àú³ÌÖÐÊä³ö SQL Ö´ÐÐÇéÐÎÒÔ±ãµ÷ÊÔ£¬¿ÉÒÔͨ¹ýÈçÏ·½·¨¿ªÆô SQL ÈÕÖ¾£º
Db::listen(function($sql, $time, $explain){ // ¼Í¼SQL trace($sql . ' [' . $time . 's]', 'sql'); // Éó²éÐÔÄÜÆÊÎöЧ¹û trace($explain, 'explain'); });
µÇ¼ºó¸´ÖÆ
ÕâÑù£¬¾Í¿ÉÒÔÔÚ³ÌÐòµÄ trace Îļþ¼ÐÖÐÊä³ö SQL ÈÕÖ¾ÐÅÏ¢ÁË¡£
ÒÔÉϾÍÊÇthinkphp5ÔõÑù¹Ø±ÕinfoÐÅÏ¢Êä³öµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡