【问题标题】:bin\cake hello prints the HelloShell.php file as it is instead of showing the outputbin\cake hello 按原样打印 HelloShell.php 文件,而不是显示输出
【发布时间】:2017-05-12 15:21:34
【问题描述】:

我对 cakePHP 完全陌生,这是我第一次尝试创建 shell。 下面是我做 bin\cake 时的输出

欢迎使用 CakePHP v3.4.6 控制台

应用程序:src 路径:C:\Users\ps23\bookmarker\src\

PHP : 7.0.10

当前路径:

  • 应用程序:源代码
  • 根目录:C:\Users\ps23\bookmarker
  • 核心:C:\Users\ps23\bookmarker\vendor\cakephp\cakephp

执行命令后:C:\Users\ps23\bookmarker>bin\cake hello。我得到以下输出:

class HelloShell extends Shell
{
        public function main()
        {
                $this->out('Hello World.');
        }
}
namespace src\Shell;

use Cake\Console\Shell;

class HelloShell extends Shell
{
        public function main()
        {
                $this->out('Hello World.');
        }
}

异常:找不到“Hello”的 Shell 类。在 [C:\Users\ps23\bookmarker\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php,第 327 行]

我尝试使用以下帖子解决此问题:Cakephp shell :Shell class HelloShell could not be found 但无法解决。

感谢任何帮助。

【问题讨论】:

  • 能否用 HelloShell.php 文件的完整内容更新您的问题?

标签: php shell cakephp


【解决方案1】:

您可以尝试将命名空间更改为App\Shell 而不是src\Shell

【讨论】:

  • 在更改为 App\Shell 并在开头添加
猜你喜欢
  • 2014-07-22
  • 2011-08-21
  • 1970-01-01
  • 2020-10-02
  • 1970-01-01
  • 2015-10-24
  • 1970-01-01
  • 1970-01-01
  • 2022-01-07
相关资源
最近更新 更多