ReflectionException: Class ClassName 不存在 - Laravel [英] ReflectionException: Class ClassName does not exist - Laravel

查看:36
本文介绍了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中的classmapcode> 文件,以便它包含您的 php 文件的项目相关路径:

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆