【问题标题】:How to fix [ErrorException] the use statement with non-compound name 'App' has no effect error displayed on cmd when php artisan serve command runphp artisan serve 命令运行时,如何修复 [ErrorException] 使用非复合名称“App”的 use 语句在 cmd 上显示无效错误
【发布时间】:2016-08-01 02:04:52
【问题描述】:

当我在终端尝试 php artisan serve 命令时,出现以下错误。任何人都可以帮我解决这个问题吗?

错误异常 非复合名称'App'的use语句无效

【问题讨论】:

标签: laravel cmd localhost laravel-5.2 laravel-artisan


【解决方案1】:

删除

use App;

从您的 route.php 文件中,它肯定会起作用。谢谢。

【讨论】:

    【解决方案2】:

    可能您添加了“使用应用程序;”在您的某些 Laravel 文件中,并且 artisan 将该行解析为错误。 要知道哪个行/文件是错误,请转到日志文件 (storage/logs/) 并检查它。然后从文件中删除该行。

    【讨论】:

      【解决方案3】:

      我特此发布我自己的问题的答案,因为我找到了答案,希望这可能对其他人有所帮助。

      之前:我只在 routes.php 中使用了“使用应用程序” 现在:当使用 'use App\Http\Controllers' 问题解决了。

      【讨论】:

        猜你喜欢
        • 2020-03-22
        • 2021-08-19
        • 1970-01-01
        • 2018-01-31
        • 2021-05-27
        • 2018-02-22
        • 2019-11-28
        • 1970-01-01
        • 2021-07-02
        相关资源
        最近更新 更多