thinkphpÖÐÔõô¹Ø±Õδ½ç˵±äÁ¿ÌáÐÑ
Ò»¡¢ÎªÊ²Ã´»á·ºÆðδ½ç˵±äÁ¿
δ½ç˵±äÁ¿Í¨³£»áÔÚÒÔÏÂÇéÐÎÖзºÆð£º
±äÁ¿Æ´Ð´¹ýʧ¡£
±äÁ¿Î´±»ÉùÃ÷»ò¸³Öµ¡£
Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
±äÁ¿×÷ÓÃÓò²»×¼È·¡£
¶þ¡¢ÔõÑù¹Ø±Õδ½ç˵±äÁ¿ÌáÐÑ
We can turn off undefined variable notice by modifying the php.ini file or configuring it within the application.¡£ÒÔÏÂÊÇÁ½ÖÖÒªÁìµÄÏêϸ˵Ã÷¡£
ÐÞ¸Äphp.iniÎļþ
·¿ªphp.iniÎļþ£¬ÔÚÆäÖÐÕÒµ½error_reportingÉèÖÃÏî¡£½«ÆäÖµ¸ü¸ÄΪÒÔÏ´úÂ룺
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
¸ÃÉèÖý«¹Ø±Õδ½ç˵±äÁ¿µÄÌáÐÑ¡£
ÔÚÓ¦ÓóÌÐòÖоÙÐÐÉèÖÃ
ÔÚThinkPHPÓ¦ÓóÌÐòÖÐÉèÖã¬×ÝÈ»Äã²»Ïë¸Ä¶¯php.iniÎļþ¡£Ê×ÏÈ£¬ÔÚpublic/index.phpÎļþÖÐÕÒµ½ÒÔÏ´úÂ룺
define(‘APP_DEBUG’, true);
½«APP_DEBUGµÄÖµ¸ÄΪfalse¡£Õ⽫¹Ø±ÕËùÓе÷ÊÔÐÅÏ¢£¬°üÀ¨Î´½ç˵±äÁ¿ÌáÐÑ¡£
³ýÁ˹رÕËùÓе÷ÊÔÐÅÏ¢Í⣬ÎÒÃÇ»¹¿ÉÒÔÕë¶Ôδ½ç˵±äÁ¿¾ÙÐйرա£¿ÉÒÔ½«ÒÔÏ´úÂëÌí¼Óµ½config.phpÎļþÖУº
‘display_not_found_error’ => false,
‘trace_exception’ => false,
ÉÏÊöÉèÖý«ÔÚÓ¦ÓóÌÐòÖйرÕδ½ç˵±äÁ¿ÌáÐÑ¡£
thinkphpÊÇʲô
thinkphpÊôÓÚÒ»ÖÖÃâ·ÑµÄ¿ª·¢¿ò¼Ü£¬Äܹ»ÓÃÓÚ¿ª·¢Ç°¶ËÍøÒ³£¬×îÔçthinkphpÊÇΪÁ˼ò»¯¿ª·¢¶ø±¬·¢µÄ£¬thinkphpͬʱҲÊÇ×ñÕÕApache2ÐÒ飬×î³õÊÇ´ÓStrutsÑݱä¹ýÀ´£¬Ò²°ÑÍâÑóһЩºÃµÄ¿ò¼Üģʽ¾ÙÐÐʹÓã¬Ê¹ÓÃÃæÏò¹¤¾ßµÄ¿ª·¢½á¹¹£¬¼æÈÝÁËÐí¶à±êÇ©¿âµÈģʽ£¬ËüÄܹ»¸üÀû±ãºÍ¿ì½ÝµÄ¿ª·¢ºÍ°²ÅÅÓ¦Óã¬ËäÈ»²»µ«½öÊÇÆóÒµ¼¶Ó¦Óã¬ÈκÎphpÓ¦Óÿª·¢¶¼¿ÉÒÔ´ÓthinkphpµÄ¼òÆÓ¡¢¼æÈݺͿìËÙµÄÌØÕ÷ÖÐÊÜÒæ¡£
ÒÔÉϾÍÊÇthinkphpÖÐÔõô¹Ø±Õδ½ç˵±äÁ¿ÌáÐѵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡