±¾ÎÄʵÀý½²ÊoÁËThinkphp5.0×Ô¶¯Éu³ÉÄ£¿e¼°Ä¿Â¼µÄ½¨¡£*ÖÏi¸ø´o¼Ò¹(C)´o¼Ò²Î¿¼£¬¾ßÌaÈçÏ£º
Thinkphp5.0¢²¼ÒÑÓÐÐ(C)ʱÈÕÁË£¬¾Ý˵ÐÔÄܽÃaeÓкܴoµÄÌaÉý£¬°´ÕÕ¹Ù½µÄ»°£¬ThinkPHP5.0°ae±¾ÊÇÒ»¸oµß¸²ºÍÖع¹°ae±¾£¬²ÉÓÃȫеļܹ¹Ë¼Ïe£¬ÒýÈeÁ˺ܶaµÄPHPÐÂÌØÐÔ£¬ÓÅ»¯Á˺ËÐÄ£¬¼oÉÙÁËÒÀÀµ£¬ÊµÏÖÁËÕaeÕýµÄ¶eÐÔ¼ÓÔØ£¬²¢Õe¶ÔAPI¿ª¢×oÁË´oÁ¿µÄÓÅ»¯¡£ÊÇʱºoµÃdownloadÒ»*Ý£¬Ñо¿Ò»Ï¡£½ñÌiÖ÷Òª½²½²Æa×Ô¶¯´´½¨Ä£¿e¼°Ä¿Â¼¡£
Thinkphp5.0×Ô¶¯Éu³ÉÄ£¿e½ÏThinkPHP3.2£¬È*ʵÓкܴoµÄ±a»¯¡£
ÔٴΣ¬Ö÷ÒªÌÖÂÛThinkphp5.0Éu³ÉÄ£¿e¡£
×¼±¸¹¤×÷
Ê×ÏÈ´Ó¹Ù*½ÏÂÔØThinkPHP5.0£¬ÏÂÔغoÎļþ½a¹¹ÈçÏ£º
Ö»±£ÁothinkphpĿ¼ÆaËuµÄËuÓÐĿ¼¼°ÎļþÒ»²¢É¾³ý£¨¿ÉÒÔÏÈתÒƵ½ÆaËuµØ*½£¬ÒÔ±¸ºoÐøʹÓã(C)
ÏÖÔھͿªÊ¼Éu³ÉÏiÄ¿ÐeҪĿ¼
thinkphp3.2´´½¨Ä¿Â¼Ã²ËƼoµ¥£¬µ«ÊÇthinkphp5.0È´¸u¼ÓÁe»i¡£²»½uÏeÆðÁËÁ¼²ÅÊǰѸ´ÔÓµÄÊÂÇe±a¼oµ¥£»Ó¹²ÅÊǰѼoµ¥µÄÊÂÇe±a¸´ÔÓ£»´À²ÄÊǰѼoµ¥µÄÊÂÇe±aµÃ¸u¼oµ¥£¬¸´ÔÓµÄÊÂÇe±aµÃ¸u¸´ÔÓ¡£
1.´´½¨Èe¿ÚÎļþindex.php£¬ËaÈ»¹Ù½Ç¿µ÷Èe¿ÚÎļþλÖ㬿ÉÒÔËaeÒaÅÖ㬵«ÊÇΪÁ˱aÓÚѧϰ£¬»¹ÊÇ*ÅÔÚ¸uĿ¼ÏÂ
// Ó¦ÓÃÈe¿ÚÎļþ
define('APP_PATH', 'application/'); // ¶¨ÒaÏiÄ¿Â*¾¶,ºÍ֮ǰ3.2°ae±¾Ã»ÓÐÇø±ð
define('APP_AUTO_BUILD',true); //¿ªÆo×Ô¶¯Éu³É
define('APP_DEBUG', true);// ¿ªÆoµ÷ÊÔģʽ
define('MODULE','module');
// ¼ÓÔØ¿o¼ÜÒýµ¼Îļþ
require 'thinkphp/start.php';
// Ö´ÐÐÓ¦ÓÃ
\think\App::run();
ÆaʵÎÒ¸oÈ˾oµÃ£¬TP¹Ù½ÎªÉ¶²»°Ñ£¬³ÌÐoµÄÖ´ÐÐ\think\App::run(); ÅÖÃÔÚstart.php Ŀ¼ÄØ?×iºo£¬*¢ÏÖÔÀ´TP5.0ÒýÈeÁËÒ»¸odefine('APP_AUTO_RUN', true);³£Á¿£¬µ±ÔÚindex.phpÒ³Ãae¶¨ÒaÁ˸ij£Á¿£¬ÏiÄ¿¾Í»a×Ô¶¯Ö´ÐУ¬²»ÐeÒªÌi¼Ó\think\App::run();
2.´´½¨ÏiÄ¿ÃuÓebuild.phpÎļþ
¸oÈ˸оothinkphp5.0×oµÄ²»ºÃµÄÒ»µa¾ÍÊÇÉÏÃae¶¨ÒaµÄÏiÄ¿Îļþ¼ÐÐeÒª×Ô¼º´´½¨£¬¾¿ÆaÔÒo£¬ÒoΪÀiÃaeÒªÅÖÃÏiÄ¿´´½¨ÅaÖÃÎļþbuild.php¡£µ«ÊÇΪɶTP¹Ù½²»°Ñbuild.php*ÅÖÃÔÚ¸uĿ¼ÏÂÄØ£¿È»ºo×Ô¶¯Éu³ÉapplicationÎļþ¼ÐÄØ£¿ÔÚÕaÒ»µaÎÒ¾oµÃTP3.2×oµÄ¾Í±È5.0ºÃ¡£
ÏÖÔÚÀ´ÌÖÂÛÒ»ÏÂbuild.php£¬¹Ù*½Ä¬ÈϵÄbulid.phpÄÚÈÝÈçÏ£¬ÏÖÔÚÀ´ÌÖÂÛÒ»ÏÂ
return [
// Éu³ÉÔËÐÐʱĿ¼
'__dir__' => ['runtime/cache', 'runtime/log', 'runtime/temp', 'runtime/template'],
'__file__' => ['common.php'],
// ¶¨ÒaindexÄ£¿eµÄ×Ô¶¯Éu³É
'index' => [
'__file__' => ['common.php'],
'__dir__' => ['behavior', 'controller', 'model', 'view'],
'controller' => ['Index', 'Test', 'UserType'],
'model' => [],
'view' => ['index/index'],
],
// ¡£¡£¡£ ÆaËu¸u¶aµÄÄ£¿e¶¨Òa
];
¿ÉÒÔ¸øÿ¸oÄ£¿e¶¨ÒaÐeÒª×Ô¶¯Éu³ÉµÄÎļþºÍĿ¼£¬ÒÔ¼°MVCÀa¡£
dir ±iʾÉu³ÉĿ¼£¨Ö§³Ö¶a¼¶Ä¿Â¼£(C)
file ±iʾÉu³ÉÎļþ£¨²»¶¨ÒaĬÈÏ»aÉu³É config.php Îļþ£(C)
controller ±iʾÉu³ÉcontrollerÀa
model±iʾÉu³ÉmodelÀa
view±iʾÉu³ÉhtmlÎļþ£¨Ö§³Ö×ÓĿ¼£(C)
×Ô¶¯Éu³ÉÒÔAPP_PATH ΪÆðʼĿ¼£¬ dir ºÍ file ±iʾÐeÒª×Ô¶¯´´½¨Ä¿Â¼ºÍÎļþ£¬ÆaËuµÄÔo±iʾΪģ¿e×Ô¶¯Éu³É¡£
Ä£¿eµÄ×Ô¶¯Éu³ÉÔoÒÔ APP_PATH.'Ä£¿eÃu/' ΪÆðʼĿ¼¡£
×iºoÖ±½ÓÔËÐÐindex.phpÎļþ¼´¿É¡£
¸u¶a¹ØÓÚthinkPHPÏa¹ØÄÚÈݸÐÐËȤµÄ¶ÁÕ߿ɲe¿´±¾Õ¾×¨Ìa£º¡¶ThinkPHPÈeÃŽ̡̳¡¢¡¶thinkPHPÄ£°a²Ù×÷¼¼ÇÉ×ܽa¡¡¢¡¶ThinkPHP³£Óý¨×ܽa¡¡¢¡¶codeigniterÈeÃŽ̡̳¡¢¡¶CI(CodeIgniter)¿o¼Ü½ø½×½Ì³Ì¡¡¢¡¶Zend FrameWork¿o¼ÜÈeÃŽ̡̳¡¢¡¶smartyÄ£°aÈeÃÅ»u´¡½Ì³Ì¡¼°¡¶PHPÄ£°a¼¼Êo×ܽa¡¡£
Ï£Íu±¾ÎÄËuÊo¶Ô´o¼Ò»uÓÚThinkPHP¿o¼ÜµÄPHP³ÌÐoÉe¼ÆÓÐËu°iÖu¡£