laravel תÒå·û
laravelÊÇÒ»¿îphpµÄwebÓ¦Óÿª·¢¿ò¼Ü£¬ËüµÄÌصãÊǼòÆÓ¡¢¸ßЧ¡¢ÎÞаÒÔ¼°Ò×ÓÚά»¤¡£Ê¹ÓÃlaravel¿ò¼Ü¾ÙÐпª·¢£¬Äܹ»ÓÐÓÃÌá¸ß¿ª·¢Ð§ÂÊ£¬ïÔÌ¿ª¾Ùʶȣ¬Í¬Ê±Ò²ÄÜ°ü¹ÜϵͳµÄÇå¾²ÐÔºÍÎȹÌÐÔ¡£ÔÚlaravel¿ò¼ÜÖУ¬×ªÒå·ûÊÇÒ»¸öºÜÖ÷ÒªµÄ¿´·¨£¬±¾ÎĽ«»áÐðÊölaravelÖÐתÒå·ûµÄÏà¹Ø֪ʶµã¡£
Ò»¡¢Ê²Ã´ÊÇתÒå·û
ÔÚ±à³ÌÖУ¬ÓÐЩÌØÊâ×Ö·û»áÔÚ´úÂëÖб¬·¢ÆçÒ壬ÀýÈçÒýºÅ¡¢·´Ð±¸ÜµÈ¡£ÎªÁËÏû³ýÕâЩÆçÒ壬ÎÒÃÇÐèҪʹÓÃתÒå·û¡£×ªÒå·ûÊÇÒ»¸öÌØÊâ×Ö·û£¬ÔÚØʺóÃæ½ôËæ×ŵÄ×Ö·û»á±»Ú¹ÊÍΪһ¸öͨË××Ö·û£¬¶ø²»ÊǾßÓÐÌØÊâ×÷ÓõÄ×Ö·û¡£ÔÚLaravel¿ò¼ÜÖУ¬³£ÓõÄתÒå·û°üÀ¨·´Ð±¸Ü¡°¡±ºÍË«ÒýºÅ¡°”¡±¡£
¶þ¡¢·´Ð±¸ÜµÄ×÷ÓÃ
ÔÚLaravelÖУ¬·´Ð±¸Ü¡°¡±ÊÇÒ»Öֺܳ£ÓõÄתÒå·û¡£ËüµÄ×÷ÓðüÀ¨£º
1.תÒåÒýºÅºÍ·´Ð±¸Ü×Ö·û
LaravelÖеÄ×Ö·û´®¾³£ÐèÒª°üÀ¨ÒýºÅ»ò·´Ð±¸Ü×Ö·û£¬ÎªÁË×èÖ¹ÕâЩÌØÊâ×Ö·ûÔì³ÉÆçÒ壬ÎÒÃÇ¿ÉÒÔÔÚËüÃÇÇ°Ãæ¼ÓÉÏ·´Ð±¸Ü×Ö·û¡£ÀýÈ磺
echo "It's a sunny day."; //Êä³ö It's a sunny day. echo 'Thisismydirectory'; //Êä³ö Thisismydirectory
µÇ¼ºó¸´ÖÆ
2.תÒåÌØÊâµÄ×Ö·û
LaravelÖУ¬·´Ð±¸ÜÒ²±»ÓÃÓÚתÒåһЩÌØÊâµÄ×Ö·û£¬ÀýÈç”
“´ú±í»»Ðзû£¬” “´ú±íÖƱí·û£¬””´ú±í»Ø³µ·ûµÈ¡£ÀýÈ磺
echo "hello world"; //Êä³ö //hello //world echo "PHP Laravel"; //Êä³ö PHP Laravel
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
3.ÃüÃû¿Õ¼äµÄʹÓÃ
ÔÚLaravelÖУ¬·´Ð±¸Ü»¹±»ÓÃÀ´ÌåÏÖÃüÃû¿Õ¼ä¡£ÃüÃû¿Õ¼äÊÇPHPÖÐÒ»¸öÖ÷ÒªµÄ¿´·¨£¬Ëü¿ÉÒÔ×ÊÖúÎÒÃÇ×èÖ¹ÃüÃû³åÍ»£¬Ìá¸ß´úÂëµÄ¿É¶ÁÐԺͿÉά»¤ÐÔ¡£ÔÚLaravelÖУ¬ÎÒÃÇ¿ÉÒÔʹÓ÷´Ð±¸ÜÀ´ÌåÏÖÏêϸµÄÃüÃû¿Õ¼ä¡£ÀýÈ磺
use AppHttpControllersHomeController;
µÇ¼ºó¸´ÖÆ
Èý¡¢Ë«ÒýºÅµÄ×÷ÓÃ
ÔÚLaravel¿ò¼ÜÖУ¬Ë«ÒýºÅÒ²ÊÇÒ»Öֺܳ£ÓõÄתÒå·û¡£ËüµÄ×÷ÓðüÀ¨£º
1.¿ÉÒÔÆÊÎö±äÁ¿
Ë«ÒýºÅÖпÉÒÔ°üÀ¨±äÁ¿£¬ÕâЩ±äÁ¿»á±»ÆÊÎöΪÏêϸµÄÖµ¡£ÀýÈ磺
$name = 'Laravel'; echo "Hello, my name is $name."; //Êä³ö Hello, my name is Laravel.
µÇ¼ºó¸´ÖÆ
2.¿ÉÒÔÆÊÎöתÒå·û
Ë«ÒýºÅÖУ¬³ýÁËһЩÌØÊâµÄ×Ö·û£¨ÀýÈç$ºÍ·´Ð±¸Ü£©£¬ÆäËûµÄ×Ö·û¶¼»á±»ÆÊÎö³ÉÏêϸµÄÖµ¡£ÀýÈ磺
echo "A backslash: \"; //Êä³ö A backslash:
µÇ¼ºó¸´ÖÆ
3.¿ÉÒÔÆÊÎöÌØÊâ×Ö·û
Ë«ÒýºÅÖУ¬Ò»Ð©ÌØÊâµÄ×Ö·û£¨ÀýÈç»»ÐзûºÍÖƱí·û£©»á±»ÆÊÎö³ÉÏêϸµÄÖµ¡£ÀýÈ磺
echo "hello world"; //Êä³ö //hello //world echo "PHP Laravel"; //Êä³ö PHP Laravel
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
ËÄ¡¢×ܽá
LaravelÖÐתÒå·ûÊÇÒ»¸öÖ÷ÒªµÄ¿´·¨£¬¹ØÓÚPHP¿ª·¢ÕßÀ´ËµºÜÊÇÊìϤ¡£ÔÚLaravel¿ò¼ÜÖУ¬·´Ð±¸ÜºÍË«ÒýºÅÊdz£ÓõÄתÒå·û¡£Í¨¹ýËüÃÇ£¬ÎÒÃÇ¿ÉÒԺܺõØ×èÖ¹´úÂëÖб£´æµÄÆçÒ壬ͬʱÌá¸ß´úÂëµÄ¿É¶ÁÐԺͿÉά»¤ÐÔ¡£ÊìÁ·ÕÆÎÕLaravelÖеÄתÒå·ûʹÓã¬Äܹ»ÈÃÎÒÃÇÔ½·¢Ë³³©µØ±àд´úÂ룬ÌáÉý¿ª·¢Ð§ÂʺʹúÂëÖÊÁ¿¡£
ÒÔÉϾÍÊÇlaravel תÒå·ûµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡