尊龙凯时人生就是搏

ÔõÑùʹÓÃThinkPHP6¾ÙÐжàÕ¾µãÖÎÀí £¿

ÔÚweb¿ª·¢ÖУ¬ÓÐʱ¼äÐèҪΪ¿Í»§½¨Éè¶à¸öÕ¾µã£¬¿ÉÊÇά»¤¶à¸öÕ¾µã»áÔöÌíÊÂÇéÁ¿£¬Õâʱ¼ä¾ÍÐèÒªÓõ½¶àÕ¾µãÖÎÀí¡£thinkphp6ÊÇÒ»¸öÓÐÁ¦µÄ¿ò¼Ü£¬ËüÖ§³Ö¶àÕ¾µãÖÎÀí¡£±¾ÎĽ«·ÖÏíÔõÑùʹÓÃthinkphp6¾ÙÐжàÕ¾µãÖÎÀí¡£

Ò»¡¢ÉèÖÃÐéÄâÖ÷»ú

ʹÓöàÕ¾µãÖÎÀí£¬ÐèÒªÔÚЧÀÍÆ÷ÉÏÉèÖÃÐéÄâÖ÷»ú¡£Ò»Ñùƽ³£ÐéÄâÖ÷»úµÄÉèÖö¼ÊÇÔÚApacheÉèÖÃÎļþÖоÙÐеÄ£¬¿ÉÒÔͨ¹ý±à¼­httpd.confÎļþʵÏÖ¡£ÀýÈ磬ÎÒÃÇÔÚÍâµØ¿ÉÒÔÉèÖÃÁ½¸öÐéÄâÖ÷»ú¡£¼ÙÉèÒ»¸öÕ¾µãÊÇwww.site1.com£¬ÁíÒ»¸öÊÇwww.site2.com£¬ÄÇôÎÒÃÇ¿ÉÒÔÕâÑùÉèÖá£

<VirtualHost *:80>
    ServerName www.site1.com
    DocumentRoot "E:/www/site1/"
    <Directory "E:/www/site1/">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName www.site2.com
    DocumentRoot "E:/www/site2/"
    <Directory "E:/www/site2/">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

µÇ¼ºó¸´ÖÆ

ÐèҪעÖØ£¬½ç˵µÄÎĵµ¸ùĿ¼±ØÐè±£´æÇҿɶÁ¿Éд¡£

¶þ¡¢½¨ÉèThinkPHP6ÏîÄ¿

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

½¨Éè¶àÕ¾µãÖÎÀíµÄÏîÄ¿ºÍ½¨ÉèͨË×ÏîĿûÓÐʲôÇø±ð¡£Ê¹ÓÃComposerÏÂÁÉèÏîÄ¿£ºcomposer create-project topthink/think myproject¡£½¨ÉèÍê³Éºó£¬Ä¿Â¼½á¹¹ÈçÏ£º

myproject
©À©¤app
©¦  ©À©¤admin
©¦  ©¸©¤index
©À©¤config
©À©¤public
©À©¤route
©À©¤runtime
©¸©¤think

µÇ¼ºó¸´ÖÆ

Õâ¸öÏîÄ¿ÏÂÓÐÁ½¸öĿ¼£¬indexºÍadmin¡£ÎÒÃÇ¿ÉÒÔ°ÑindexĿ¼¿´×÷ÊÇÒ»¸öÕ¾µãµÄ¸ùĿ¼£¬adminĿ¼¿´×÷ÊÇÁíÒ»¸öÕ¾µãµÄ¸ùĿ¼¡£ÎªÁËÀû±ãÖÎÀí£¬ÎÒÃÇ¿ÉÒÔ½«ËüÃÇÉèÖÃΪµ¥¶ÀµÄÓ¦ÓóÌÐò¡£

Èý¡¢¶àÓ¦ÓÃÉèÖÃ

ΪÁËʵÏÖ¶àÓ¦ÓóÌÐòµÄÖÎÀí£¬ÎÒÃÇÐèÒªÔÚÉèÖÃÎļþÖоÙÐÐÐ޸ġ£

ÐÞ¸Äapp.php

app.phpÎļþÔÚconfigĿ¼Ï¡£Ê×ÏÈ£¬ÎÒÃÇÐèÒªÔÚÉèÖÃÎļþÖÐÉèÖÃauto_multi_appΪtrue¡£

return [
    'auto_multi_app' => true,
    'app_map' => [
        'site1'     => 'index',
        'site2'     => 'admin',
    ],
    ...
];

µÇ¼ºó¸´ÖÆ

È»ºó£¬ÎÒÃÇʹÓÃapp_mapÏîÀ´ÎªÃ¿¸öÕ¾µã½ç˵ӦÓóÌÐò¡£ºÃ±È£¬ÎÒÃǽ«site1ÉèΪindexÓ¦ÓóÌÐò£¬site2ÉèΪadminÓ¦ÓóÌÐò¡£

ÐÞ¸Äroute.php

·­¿ªroute.phpÎļþ£¬ÎªÃ¿¸öÕ¾µãÉèÖ÷ÓɹæÔò¡£ºÃ±È£¬¹ØÓÚsite1Õ¾µã£¬ÎÒÃÇ¿ÉÒÔÕâÑùÉèÖãº

Route::domain('www.site1.com', function () {
    Route::get('/', 'index/hello');
});

µÇ¼ºó¸´ÖÆ

Õ⽫Ϊwww.site1.com°ó¶¨indexÓ¦ÓóÌÐòÖеÄIndex¿ØÖÆÆ÷ÉϵÄhelloÒªÁì¡£

ͬÑùµÄ£¬¹ØÓÚsite2Õ¾µã£¬ÎÒÃǵÄÉèÖÿÉÄÜÊÇÕâÑùµÄ£º

Route::domain('www.site2.com', function () {
    Route::get('/', 'admin/hello');
});

µÇ¼ºó¸´ÖÆ

Õ⽫Ϊwww.site2.com°ó¶¨adminÓ¦ÓóÌÐòÖеÄIndex¿ØÖÆÆ÷ÉϵÄhelloÒªÁì¡£

ËÄ¡¢²âÊÔ

ÏÖÔÚ£¬ÎÒÃÇÒѾ­Íê³ÉÁ˶àÕ¾µãÖÎÀíµÄÉèÖá£ÏÖÔÚÎÒÃÇÀ´²âÊÔһϡ£·­¿ªä¯ÀÀÆ÷£¬ÔڵصãÀ¸ÖÐÊäÈëwww.site1.com£¬ÄãÓ¦¸Ã¿ÉÒÔ¿´µ½indexÓ¦ÓóÌÐòµÄIndex¿ØÖÆÆ÷ÖеÄhelloÒªÁìµÄÊä³ö¡£Í¬ÑùµÄ£¬ÊäÈëwww.site2.com£¬ÄãÓ¦¸Ã¿ÉÒÔ¿´µ½adminÓ¦ÓóÌÐòÖеÄIndex¿ØÖÆÆ÷ÖеÄhelloÒªÁìµÄÊä³ö¡£

ÈôÊÇÓÐÈκÎÎÊÌ⣬Çë¼ì²éÄãµÄÐéÄâÖ÷»úÉèÖá¢Â·ÓÉÉèÖõÈ¡£

Îå¡¢×ܽá

ʹÓÃThinkPHP6¾ÙÐжàÕ¾µãÖÎÀí²¢²»ÄÑÌ⣬Ҫº¦ÊÇÒªºÏÀí°²ÅÅĿ¼½á¹¹¡¢Ó¦ÓóÌÐòÖÎÀíºÍ·ÓÉÉèÖ㬲¢ÉèÖúÃÏà¹ØµÄÐéÄâÖ÷»ú¡£Í¨¹ýÕâƪÎÄÕ£¬ÐÅÍÐÄúÒѾ­ÏàʶÁËÔõÑùʹÓÃThinkPHP6¾ÙÐжàÕ¾µãÖÎÀí¡£

ÒÔÉϾÍÊÇÔõÑùʹÓÃThinkPHP6¾ÙÐжàÕ¾µãÖÎÀí £¿µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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