ÏêϸÏÈÈÝLaravelµÄ×°ÖÃÉèÖÃ
laravelÊÇÒ»ÖÖÊ¢ÐеÄphp¿ò¼Ü£¬ËüµÄÉè¼ÆÄ¿µÄÊÇΪÁ˼ò»¯webÓ¦ÓóÌÐòµÄ¿ª·¢Àú³Ì¡£laravelµÄ½¹µãÀíÄîÊÇ¡°ÓÅÑž«Á·¡±£¬Ëü¾ßÓиßЧµÄ·ÓÉ¡¢Ä£°åÒýÇæ¡¢ormµÈÌØÕ÷¡£ÔÚÕâƪÎÄÕÂÖУ¬ÎÒÃÇÀ´ÏêϸÏÈÈÝlaravelµÄ×°ÖÃÉèÖá£
Ò»¡¢×°ÖÃLaravel
ÔÚ×îÏÈ֮ǰ£¬ÇëÈ·±£ÄãÒÑ×°ÖÃÁËPHP¡¢ComposerºÍGit¡£ÈôÊÇÄ㻹ûÓÐ×°ÖÃËüÃÇ£¬ÇëÏÈ×°ÖÃËüÃÇ¡£×°ÖÃÍê³Éºó£¬Äã¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÔÚÏÂÁîÐÐÖÐ×°ÖÃLaravel£º
composer global require laravel/installer
µÇ¼ºó¸´ÖÆ
×°ÖÃÍê³Éºó£¬Äã¿ÉÒÔʹÓÃÒÔÏÂÏÂÁÉèÒ»¸öеÄLaravelÏîÄ¿£º
laravel new myproject
µÇ¼ºó¸´ÖÆ
Õ⽫ÔÚÄ¿½ñĿ¼Öн¨ÉèÒ»¸öÃûΪ¡°myproject¡±µÄÐÂÏîÄ¿¡£ÄãÒ²¿ÉÒÔͨ¹ýÔÚlaravel newÏÂÁîºóÌí¼ÓÏîÄ¿Ãû³ÆÀ´Ö¸¶¨ÈκÎÆäËûĿ¼Ãû³Æ¡£
¶þ¡¢ÉèÖÃLaravel
ÔÚ×°ÖÃLaravelºó£¬ÄãÐèÒª¾ÙÐÐһЩ¼òÆÓµÄÉèÖá£
ÉèÖÃÓ¦ÓóÌÐòÃÜÔ¿
LaravelÐèÒªÒ»¸öÓ¦ÓóÌÐòÃÜÔ¿À´¼ÓÃÜÓû§»á»°ºÍÆäËûÊý¾Ý¡£Äã¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´ÌìÉúÓ¦ÓóÌÐòÃÜÔ¿£º
php artisan key:generate
µÇ¼ºó¸´ÖÆ
ÉèÖÃÊý¾Ý¿â
·¿ªLaravelÏîÄ¿ÖеÄ.envÎļþ£¬ÉèÖÃÊý¾Ý¿âÅþÁ¬ÐÅÏ¢£º
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=mydatabase DB_USERNAME=myusername DB_PASSWORD=mypassword
µÇ¼ºó¸´ÖÆ
ÉèÖÃÓ¦ÓóÌÐòµ÷ÊÔģʽ
ÔÚ¿ª·¢Àú³ÌÖУ¬Äã¿ÉÄÜÐèÒªÆôÓõ÷ÊÔģʽ¡£·¿ª.envÎļþ²¢½«APP_DEBUGÉèÖÃΪtrue£º
APP_DEBUG=true
µÇ¼ºó¸´ÖÆ
ÔËÐÐÊý¾Ý¿âǨáã
LaravelÖеÄǨáãÊÇÊý¾Ý¿âµÄ°æ±¾¿ØÖÆϵͳ¡£ÔÚ×°ÖÃÀֳɺó£¬ÄúÐèÒªÔËÐÐÒÔÏÂÏÂÁîÀ´ÔËÐÐLaravel×Ô´øµÄÊý¾Ý¿âǨá㣺
php artisan migrate
µÇ¼ºó¸´ÖÆ
Õ⽫¸üÐÂÄúµÄÊý¾Ý¿â¼Ü¹¹£¬½¨Éè±íºÍ±íÖ®¼äµÄ¹ØϵµÈ¡£
Èý¡¢ÔËÐÐLaravelÓ¦ÓóÌÐò
ÏÖÔÚ£¬ÄãÒѾÍê³ÉÁËLaravelµÄ×°ÖúÍÉèÖ㬿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÀ´ÔËÐÐLaravelÓ¦ÓóÌÐò£º
php artisan serve
µÇ¼ºó¸´ÖÆ
Õ⽫ÔÚµ±ÌïÖ÷»úÉÏÆô¶¯WebЧÀÍÆ÷£¬²¢ÔÚĬÈ϶˿Ú8000ÉÏÔËÐÐLaravelÓ¦ÓóÌÐò¡£ÔÚä¯ÀÀÆ÷Öлá¼ûhttp://localhost:8000¼´¿É·¿ªÓ¦ÓóÌÐò¡£
×ܽá
ÔÚ±¾ÎÄÖУ¬ÎÒÃÇÏÈÈÝÁËÔõÑù×°ÖúÍÉèÖÃLaravel¿ò¼Ü¡£ÔÚ×°ÖÃLaravelºó£¬ÄãÐèÒª¾ÙÐÐһЩ¼òÆÓµÄÉèÖã¬ÈçÉèÖÃÓ¦ÓóÌÐòÃÜÔ¿¡¢ÉèÖÃÊý¾Ý¿â¡¢ÉèÖÃÓ¦ÓóÌÐòµ÷ÊÔģʽºÍÔËÐÐÊý¾Ý¿âǨáã¡£×îºó£¬Äã¿ÉÒÔͨ¹ýÔËÐÐLaravelÓ¦ÓóÌÐòÀ´Æô¶¯ÄãµÄÏîÄ¿¡£LaravelÊÇÒ»¿î¸ßЧ¡¢ÓÅÑźÍÇáÓ¯µÄPHP¿ò¼Ü£¬Ê¹ÓÃËü¿ÉÒÔ´ó´ó¼ò»¯WebÓ¦ÓóÌÐòµÄ¿ª·¢Àú³Ì¡£
ÒÔÉϾÍÊÇÏêϸÏÈÈÝLaravelµÄ×°ÖÃÉèÖõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡