Laravel prompts "Classnotfound" when executing the migrate operation-PHP source code

Source: Internet
Author: User
Tags autoload
The Classnotfound prompt is that the class is not found. If the corresponding class is not found, we can check whether there is a problem with the configuration or call, next, let's take a look at the solution to the "Classnotfound" prompt for Laravel to execute the migrate operation, as shown below. The prompt "Class not found" is that the Class is not found. If the corresponding Class is not found, we can check whether there is a problem with the configuration or call, next, let's take a look at the solution to the "Class not found" prompt for Laravel to execute the migrate operation, as shown below.

Script ec (2); script

If you use Laravel's artisan command tool to execute the migrate operation, a "Class not found" error is prompted, but this migrate Class file exists. If you encounter this problem, run the following composer dump-autoload command to solve the problem.

The first error is as follows:


[Root @ iZ94r80gdghZ tanteng. me] # php artisan migrate: reset

[Symfony \ Component \ Debug \ Exception \ FatalThrowableError]
Fatal error: Class 'createattachmenttable' not found

No matter what the migrate operation is executed, the system prompts that the class cannot be found.

After you run composer dump-autoload, run the migrate operation again.

[Root @ iZ94r80gdghZ tanteng. me] # composer dump-autoload
Generating autoload files
[Root @ iZ94r80gdghZ tanteng. me] # php artisan migrate: reset
Rolled back: 2016_03_30_104849_create_attachment_table
Rolled back: 2016_03_07_094057_create_admins_table
Rolled back: 2016_02_22_102354_entrust_setup_tables
Rolled back: 2016_02_22_091444_my_ask_anwser_table
Rolled back: 2014_10_12_100000_create_password_resets_table
Rolled back: 2014_10_12_000000_create_users_table
Role of composer dump-autoload

The function of the composer dump-autoload command is to optimize automatic loading. When the code is deployed to the production environment or the class files in the automatically loaded folder are deleted, You need to execute the automatic loading command, in this way, automatic loading will take effect.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.