Laravel - Method [xxx] does not exist on [xxx]
the controller is existing, and the method 'test' exist on 'app\http\controllers\admin\indexcontroller'. but laravel show me that there is no method on the controller, i don't know why. i have askd for help on the internet, but no one can help me. the error like pic1.
now i show you my project folder and the files.
the namespace of the indexcontroller.php is right. and the method test is existed. but laravel told me that method does not exist... i don't know what happend!
maybe you have the same trouble, now, i will give you a way to solve the problem. then, let's go.
look at this file.
there is a backup file in my project. i had edited the controller file after created the backup file. so the content of the two files is different. initially, there is no problem. but when i execute the command "composer update"... oh, my god!
now, look at the directory vendor/composer, and open the file autoload_clappmap.php and autoload_static.php. search indexcontroller in the two files.
in autoload_classmap.php:
in autoload_static.php:
look at the red box. the real file is not indexcontroller.php, but is the backup file. i have said, the two file is different. the method test does not on indexcontroller.bk.php. so laravel show me the error.
we have known why the problem happend. now, we should solve it.
1) update the 'indexcontroller.bk.php' to 'indexcontroller.php' that in the autoload_classmap.php and autoload_static.php.
2) or you can delete the backup file or move it to other directory, then do 1).
3) or you can delete the backup file or move it to other directory. then execute the command composer update. but it is slow...
report:
developing good programming habits can avoid many mistakes.
上一篇: homestead的创建和使用
推荐阅读
-
Laravel - Method [xxx] does not exist on [xxx]
-
Method not found: 'System.Data.Entity.ModelConfiguration.Configuration.XXX
-
Parameter 0 of method setFunctionDomainRedisTemplate in XXX required a single bean, but 2 were found
-
The method xxx of type xxx must override or implement a supertype method
-
Mapped Statements collection does not contain value for XXX
-
Mapped Statements collection does not contain value for xxx
-
[email protected]使用报错:Mapped Statements collection does not contain value for XXX
-
Ambiguous mapping found. Cannot map 'xxx' bean method
-
linux交叉编译的库在链接时提示:xxx uses VFP register arguments xxx does not
-
TCLCN使用过程中,出现 ‘Table ‘XXX.hibernate_sequence‘ doesn‘t exist’