ReflectionException: Class ClassName does not exist - Laravel(ReflectionException: Class ClassName 不存在 - Laravel)
问题描述
很快,我正在输入 php artisan db:seed
命令.
As soon, I am typing php artisan db:seed
command.
我收到错误喜欢:
[反射异常]
类 UserTableSeeder 不存在
[ReflectionException]
Class UserTableSeeder does not exist
root@dd-desktop:/opt/lampp/htdocs/dd/laravel# php artisan db:seed
这是我的 UserTableSeeder.php
&DatabaseSeeder.php
页
Here, Is my UserTableSeeder.php
& DatabaseSeeder.php
Page
UserTableSeeder.php
<?php
use IlluminateDatabaseSeeder;
use IlluminateDatabaseEloquentModel;
class UserTableSeeder extends Seeder
{
public function run()
{
DB::table('users')->delete();
User::create(array(
'name' => 'Chris Sevilleja',
'username' => 'sevilayha',
'email' => 'chris@scotch.io',
'password' => Hash::make('awesome'),
));
}
}
DatabaseSeeder.php
<?php
use IlluminateDatabaseSeeder;
use IlluminateDatabaseEloquentModel;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
$this->call('UserTableSeeder');
}
}
我将这个链接推荐给设计&开发登录页面.请帮我解决这个问题.谢谢.
I'm Referring This Link To Design & Develop Login Page. Please Help me to resolve this issue. Thanks.
推荐答案
执行 composer update
,然后 composer dump-autoload
.
如果上述方法不能解决问题,请更改composer.json中的
文件,以便它包含您的 php 文件的项目相关路径:classmap
code>
If the above doesn't solve the problem, change the classmap
in your composer.json
file such that it contains the project-relative path to your php files:
"autoload-dev": {
"classmap": [
"tests/TestCase.php",
"database/seeds/UserTableSeeder.php" //include the file with its path here
]
}, /** ... */
不久之后,执行composer dump-autoload
,它现在应该像微风一样工作!
and soon after, perform a composer dump-autoload
, and it should work now like a breeze!
如果没有找到composer dump-autoload
,只需启用这个选项composer config -g -- disable-tls true
.
If composer dump-autoload
is not found, just enable this option composer config -g -- disable-tls true
.
这篇关于ReflectionException: Class ClassName 不存在 - Laravel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:ReflectionException: Class ClassName 不存在 - Laravel


基础教程推荐
- HTTP 与 FTP 上传 2021-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- PHP 守护进程/worker 环境 2022-01-01
- 使用 PDO 转义列名 2021-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01