×ðÁú¿­Ê±¹ÙÍøµÇ¼

laravel ·­¿ª¹ýʧÌáÐÑ

µ±ÄãÔÚʹÓà laravel ¾ÙÐпª·¢Ê±£¬¿ÉÄÜ»áÓöµ½Ò»Ð©¹ýʧÌáÐÑ¡£ÕâЩ¹ýʧÌáÐÑ¿ÉÄÜ»áÈÃÄã¸ÐÓ¦ÒÉÐÄ£¬È´ÓÖÎÞ´ÓÏÂÊÖ¡£

±¾ÎĽ«½ÌÄãÔõÑù·­¿ª Laravel µÄ¹ýʧÌáÐÑ£¬ÒÔ¼°ÔõÑùͨ¹ý¹ýʧÌáÐÑÀ´¶¨Î»Ï¢Õù¾öÎÊÌâ¡£

ÔÚ Laravel Öз­¿ª¹ýʧÌáÐÑ

ĬÈÏÇéÐÎÏ£¬Laravel ÔÚÉú²úÇéÐÎÏÂÊǹرչýʧÌáÐѵÄ¡£ÕâÊdzöÓÚÇ徲˼Á¿£¬×èÖ¹¹¥»÷Õßͨ¹ý¹ýʧÌáÐÑ»ñµÃÃô¸ÐÐÅÏ¢¡£

µ«ÔÚ¿ª·¢Àú³ÌÖУ¬ÄãÐèÒª·­¿ª¹ýʧÌáÐÑ£¬ÒÔ±ãʵʱ·¢Ã÷²¢½â¾öÎÊÌâ¡£

Òª·­¿ª Laravel µÄ¹ýʧÌáÐÑ£¬¿ÉÒÔƾ֤ÒÔÏ°취²Ù×÷£º

·­¿ª Laravel ÏîĿĿ¼Ï嵀 .env Îļþ£¬²éÕÒ APP_ENV ÐС£

½« APP_ENV= ºóÃæµÄÖµ´Ó production ¸ÄΪ local£¬ÉúÑÄÎļþ¡£

Ö´ÐÐÒÔÏÂÏÂÁ

php artisan config:cache

µÇ¼ºó¸´ÖÆ

ÖØÐÂÆô¶¯ Laravel µÄЧÀÍ¡£

ÏÖÔÚ£¬µ±ÄãÔÚ¿ª·¢ÇéÐÎÖлá¼û Laravel ʱ£¬¾Í»á¿´µ½ÏêϸµÄ¹ýʧÌáÐÑÁË¡£

½â¶Á Laravel µÄ¹ýʧÌáÐÑ

µ±ÄãÔÚ Laravel ÖÐÓöµ½¹ýʧʱ£¬»áÊÕµ½Ò»¸öÀàËÆÏÂÃæÕâÑùµÄ¹ýʧÌáÐÑ£º

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name' in 'where clause' (SQL: select * from `users` where `name` = test)

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

Õâ¸ö¹ýʧÌáÐѸæËßÎÒÃÇÕâ¸ö SQL ÅÌÎÊÓï¾äÖзºÆðÁËÒ»¸ö¹ýʧ£¬ÏêϸÀ´Ëµ£¬ÊÇ name ×ֶβ»±£´æ¡£Õâ¸ö¹ýʧÌáÐѸøÎÒÃÇÌṩÁËÈýÌõÖ÷ÒªµÄÐÅÏ¢£º

¹ýʧÀàÐÍ£ºÕâÊÇÒ»¸ö SQLSTATE ¹ýʧ´úÂ룬ÓÃÓÚΨһ±êʶ¹ýʧÀàÐÍ¡£

¹ýʧÌáÐÑ£ºÕâÊÇÖ¸ÍÉ»¯ÎóËùÔÚµÄÏêϸλÖã¬ÒÔ¼°¹ýʧµÄÔµ¹ÊÔ­ÓÉ¡£

¹ýʧλÖãºÕâÊÇÖ¸ÍÉ»¯ÎóËùÔÚµÄÏêϸλÖá£

³ýÁË SQL ÅÌÎʹýʧ֮Í⣬Laravel »¹»áÌṩÆäËûÀàÐ͵ĹýʧÌáÐÑ£¬ÀýÈç PHP ¹ýʧ£¨Èç±äÁ¿Î´½ç˵»òº¯Êý²»±£´æ£©£¬Ä£°åÓï·¨¹ýʧµÈ¡£

½ÓÏÂÀ´£¬ÎÒ½«Öð¸öչʾһЩ Laravel ³£¼ûµÄ¹ýʧÀàÐÍ£¬²¢Ìṩ½â¾öÒªÁì¡£

SQL ÅÌÎʹýʧ

SQL ÅÌÎʹýʧÊÇÔÚ Laravel Ó¦ÓóÌÐòÖÐ×î³£¼ûµÄ¹ýʧÀàÐÍÖ®Ò»¡£ÏÂÃæÊÇһЩ SQL ÅÌÎʹýʧµÄʾÀýÒÔ¼°½â¾öÒªÁ죺

Column not found

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name' in 'where clause' (SQL: select * from `users` where `name` = test)

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

Õâ¸ö¹ýʧÌáÐѸæËßÎÒÃÇ name ×ֶβ»±£´æ¡£ÈôÊÇÎÒÃǸú×Ù SQL ÅÌÎÊÓï¾ä£¬¾Í»á·¢Ã÷Ó¦¸ÃʹÓõÄÊÇ username ×ֶζø²»ÊÇ name ×ֶΡ£

Table not found

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydatabase.userss' doesn't exist (SQL: select * from `userss` where `email` = test@example.com)

µÇ¼ºó¸´ÖÆ

Õâ¸ö¹ýʧÌáÐѸæËßÎÒÃÇ userss ±í²»±£´æ¡£ÎÒÃÇÐèÒª¼ì²é²¢È·ÈϱíÃûÊÇ·ñ׼ȷƴд¡£

PHP ¹ýʧ

³ýÁË SQL ÅÌÎʹýʧ֮Í⣬ÓÐʱÄ㻹»áÓöµ½ÆäËûÀàÐ͵Ĺýʧ£¬ÀýÈç PHP ¹ýʧµÈ¡£ÏÂÃæÊÇһЩ³£¼ûµÄ PHP ¹ýʧµÄʾÀýÒÔ¼°½â¾öÒªÁ죺

Undefined variable

Undefined variable: user (View: /var/www/resources/views/users/show.blade.php)

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

Õâ¸ö¹ýʧÌáÐѸæËßÎÒÃÇ $user ±äÁ¿Î´½ç˵¡£ÎÒÃÇÐèÒª¼ì²é²¢È·ÈÏÊÇ·ñ׼ȷµØ½ç˵Á˸ñäÁ¿£¬»òÕßÔÚʹÓøñäÁ¿Ö®Ç°ÊÇ·ñ׼ȷµØ³õʼ»¯ÁËËü¡£

Call to undefined function

Call to undefined function AppHttpControllersHomeControlleroo()

µÇ¼ºó¸´ÖÆ

Õâ¸ö¹ýʧÌáÐѸæËßÎÒÃÇ HomeController ÖÐµÄ foo() º¯Êý²»±£´æ¡£ÎÒÃÇÐèÒª¼ì²é²¢È·Èϸú¯ÊýÊÇ·ñ׼ȷ½ç˵£¬»òÕßÊÇ·ñÔÚŲÓøú¯Êý֮ǰ׼ȷÒýÈëÁËËü¡£

Ä£°åÓï·¨¹ýʧ

ÔÚʹÓà Laravel µÄÊÓͼģ°åʱ£¬Äã¿ÉÄÜ»áÓöµ½Ä£°åÓï·¨¹ýʧ¡£ÏÂÃæÊÇһЩ³£¼ûµÄÄ£°åÓï·¨¹ýʧµÄʾÀýÒÔ¼°½â¾öÒªÁ죺

Syntax error

syntax error, unexpected ')', expecting variable (T_VARIABLE) or '{' or '$'

µÇ¼ºó¸´ÖÆ

Õâ¸ö¹ýʧÌáÐѸæËßÎÒÃÇ´úÂëÖÐÓÐÓï·¨¹ýʧ£¬×î¿ÉÄÜÊÇÀ¨ºÅ²»Æ¥Åä¡£ÎÒÃÇÐèÒª¼ì²é²¢È·ÈÏËùÓÐÀ¨ºÅÊÇ·ñ׼ȷƥÅä¡£

Undefined variable

Undefined variable: user (View: /var/www/resources/views/users/show.blade.php)

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

Õâ¸ö¹ýʧÌáÐѸæËßÎÒÃÇ $user ±äÁ¿Î´½ç˵¡£ÎÒÃÇÐèÒª¼ì²é²¢È·ÈÏÊÇ·ñ׼ȷµØ½ç˵Á˸ñäÁ¿£¬ÔÚʹÓøñäÁ¿Ö®Ç°ÊÇ·ñ׼ȷµØ³õʼ»¯ÁËËü¡£

½áÂÛ

ÔÚ Laravel ÖÐʹÓùýʧÌáÐÑ¿ÉÒÔ×ÊÖúÄãʵʱ·¢Ã÷²¢½â¾öÎÊÌ⡣ͨ¹ý׼ȷµØ½â¶Á¹ýʧÌáÐÑ£¬ÎÒÃÇ¿ÉÒÔÕÒµ½ÎÊÌâËùÔÚ²¢½ÓÄÉÏìÓ¦µÄ½â¾öÒªÁì¡£

ÔÚ¿ª·¢ºÍ²âÊԽ׶ÎÖУ¬ÄãÓ¦¸Ã½« Laravel µÄ .env ÎļþÖÐµÄ APP_ENV ÉèÖÃΪ local À´·­¿ª¹ýʧÌáÐÑ£¬ÒÔ±ã¸üÈÝÒ׵ط¢Ã÷¹ýʧ¡£µ«ÔÚÉú²úÇéÐÎÖУ¬ÄãÓ¦¸Ã½« APP_ENV ÉèÖÃΪ production À´¹Ø±Õ¹ýʧÌáÐÑ£¬ÒÔ×èÖ¹Ãô¸ÐÐÅÏ¢×ß©¡£

Ï£Íû±¾ÎÄÄÜ×ÊÖúÄã¸üºÃµØÃ÷È· Laravel ÖеĹýʧÌáÐÑ£¬²¢Ë³ËìÍê³ÉÏîÄ¿¿ª·¢¡£

ÒÔÉϾÍÊÇlaravel ·­¿ª¹ýʧÌáÐѵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

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

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

QR code
ÍøÕ¾µØͼ