尊龙凯时人生就是博

thinkphpÔõô¼ÓÔØ

thinkphpµÄ×Ô¶¯¼ÓÔع¦Ð§ÊÇ¿ª·¢thinkphpÓ¦ÓóÌÐòʱ±Ø²»¿ÉÉÙµÄÒ»ÏЧ£¬Äܹ»×ÊÖú¿ª·¢ÕßÔ½·¢¿ìËٵؾÙÐпª·¢¡£Òò´Ë£¬ÊìÁ·ÕÆÎÕthinkphpµÄ×Ô¶¯¼ÓÔع¦Ð§¹ØÓÚ¿ª·¢ÕßÀ´ËµºÜÊÇÖ÷Òª¡£

ÒÔÏÂÊÇһЩ¹ØÓÚThinkPHP×Ô¶¯¼ÓÔصÄÏÈÈݺÍʹÓÃÒªÁ죺

1.×Ô¶¯¼ÓÔØÔ­Àí£º

»ù±¾ÉÏ£¬ThinkPHPµÄ×Ô¶¯¼ÓÔØÊÇͨ¹ýPHPµÄħÊõÒªÁì__autoload()À´ÊµÏֵġ£µ±ÒýÓÃÒ»¸öδ½ç˵µÄÀàʱ£¬PHPÒýÇæ»á×Ô¶¯Å²ÓÃ__autoload()ÒªÁ죬½«ÐèÒªµÄÀà´ÓÖ¸¶¨µÄĿ¼ÖÐÔØÈë¡£

2.×Ô¶¯¼ÓÔØʹÓÃÒªÁ죺

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

ÔÚThinkPHPÖУ¬×Ô¶¯¼ÓÔع¦Ð§ÊÇĬÈÏ¿ªÆôµÄ£¬ÒÔÊÇÔÚ¾ø´ó´ó¶¼ÇéÐÎÏ£¬Äú²»ÐèÒª¾ÙÐÐÈκεÄÊÖ¶¯ÉèÖá£Ö»ÐèÒªÔÚÄúµÄ´úÂëÖÐʹÓÃËùÐèµÄÀ࣬ϵͳ¾Í»á×Ô¶¯Ñ°ÕÒ¶ÔÓ¦µÄÀàÎļþ£¬²¢½«ÆäÔØÈë¡£

ÈôÊÇÄúÐèÒªÊÖ¶¯¼ÓÔØij¸öÀ࣬ÄÇô¿ÉÒÔʹÓÃThinkPHPÌṩµÄautoload()º¯Êý£¬¸Ãº¯Êý¿ÉÒÔ¼ÓÔØÈκÎÒ»¸öÀàÎļþ¡£ÀýÈ磺

<?php     autoload('SomeClass');
?>

µÇ¼ºó¸´ÖÆ

3.ÀàµÄ×Ô¶¯¼ÓÔØ˳Ðò£º

ÔÚ¼ÓÔØÀàʱ£¬ThinkPHPƾ֤ÒÔÏÂ˳Ðò¾ÙÐвéÕÒ£º

¢Ù ÄÚºËÀà¿â£¨ThinkPHP\Library\Think¡¢ThinkPHP\Library\BehaviorµÈ£©£»

¢Ú Ä¿½ñÓ¦ÓÃÀà¿â£¨APP_PATH.’Common/Behavior’µÈ£©£»

¢Û Ä¿½ñ¿ØÖÆÆ÷ÀàĿ¼£¨MODULE_NAME.’/Controller’µÈ£©ÏµÄÀàÎļþ£»

¢Ü Ä¿½ñÄ£×ÓÀàĿ¼£¨MODULE_NAME.’/Model’µÈ£©ÏµÄÀàÎļþ¡£

ÈôÊÇÄúµÄÀàÃû³ÆÓëThinkPHP×Ô´øµÄÀàÖØÃû£¬ÄÇôThinkPHPµÄ×Ô¶¯¼ÓÔØÓÅÏÈʹÓÃÄúËù×Ô½ç˵µÄÀà¡£

4.×Ô½ç˵Àà¿âµÄ×Ô¶¯¼ÓÔØÒªÁ죺

ÈôÊÇÄúÐèÒª×Ô½ç˵һ¸öÀà¿â£¬ÈÃËüÄܹ»±»ThinkPHPµÄ×Ô¶¯¼ÓÔØ»úÖÆËùʶ±ð£¬Äú¿ÉÒÔ½«¸ÃÀà¿âĿ¼¼ÓÈëµ½APP_PATHϵÄÎļþ¼ÐÖУ¨ÀýÈ磺APP_PATH.’MyLibs’£©£¬²¢ÇÒÔÚ¸ÃĿ¼ÏÂн¨autoload.phpÎļþ£¬¸ÃÎļþÐèÒª°üÀ¨Ò»¸öº¯Êý£¬ÓÃÓÚÖ´ÐÐÀàµÄÔØÈë²Ù×÷¡£ÀýÈ磺

<?php     spl_autoload_register(function ($class){
        $file = APP_PATH . str_replace('\\', '/', $class) . '.php';
        if (is_file($file)) {
            include $file;
        }
    });
?>

µÇ¼ºó¸´ÖÆ

5.×Ô¶¯¼ÓÔصĻº´æ£º

ThinkPHPµÄ×Ô¶¯¼ÓÔØ»úÖÆ¿ÉÒÔ½«³£ÓõÄÀàÎļþ»º´æµ½ÄÚ´æÖУ¬Ìá¸ßÐÔÄÜ¡£Äú¿ÉÒÔÔÚÉèÖÃÎļþÖÐÉèÖãº

return array(
    'app_init'=&gt;array('Common\Behavior\InitHookBehavior'),
    'autocache' =&gt; true
);

µÇ¼ºó¸´ÖÆ

ÕâÀïÎÒÃÇ¿ªÆôÁË×Ô¶¯¼ÓÔصĻº´æ¹¦Ð§£¬½«ÆôÓÃapp_init¹³×Ó£¬²¢Ôڸù³×ÓÖÐÖ´ÐÐÁËÒ»¸öInitHookBehaviorÀàµÄ³õʼ»¯²Ù×÷¡£

×ÛÉÏËùÊö£¬¿ÉÒÔ¿´³öThinkPHPµÄ×Ô¶¯¼ÓÔØ»úÖƺÜÊÇÎÞаºÍ¼òÆÓ£¬¿ª·¢Õß¿ÉÒÔƾ֤×Ô¼ºµÄÐèÇó¾ÙÐÐÏìÓ¦µÄÉèÖá£Í¬Ê±£¬Ê¹ÓÃ×Ô¶¯¼ÓÔØ»úÖÆÄܹ»¼«´óµØ¼ÓËÙ¿ª·¢Ð§ÂÊ£¬²¢Ìá¸ßÓ¦ÓóÌÐòµÄÐÔÄÜ¡£

ÒÔÉϾÍÊÇthinkphpÔõô¼ÓÔصÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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