【问题标题】:Eloquent Tinker - Undefined ConstantEloquent Tinker - 未定义常量
【发布时间】:2015-06-17 06:04:27
【问题描述】:

我正在关注 laravel 上的这组 tutorials(他们很棒),我一直遇到这个错误:

PHP error:  Use of undefined constant Article

每当我输入这行代码时:

$article = new App/Article;

我已经按照字母顺序执行了所有操作,并使用了命令:

$ php artisan make:model Article
Model created successfully.
Created Migration: 2015_04_11_152306_create_ar

我发现不寻常的是,在本教程中,调用此命令时没有创建迁移。无论如何,我正在尝试通过 tinker 将一些数据输入到我的 sqlite 数据库中,但我无法创建 Article 对象,因此无法插入到数据库中。我将如何解决或绕过这个问题?

【问题讨论】:

    标签: php laravel eloquent laravel-artisan artisan-migrate


    【解决方案1】:

    你应该使用反斜杠\:

    $article = new App\Article;
    

    【讨论】:

    猜你喜欢
    • 2021-07-17
    • 2020-06-23
    • 2015-12-20
    • 2023-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多