在 CakePHP v2.6.4 中运行:./cake hello,报错:Error Shell class HelloShell could not be found. 的分析解决

1、参考网址:https://book.cakephp.org/2/en/console-and-shells.html ,创建一个简单的 Hello world shell。 在应用程序的 Console/Command 目录中,创建 HelloShell.php。

<?php
/**
 * Created by PhpStorm.
 * User: Qiang Wang
 * Date: 2020/08/18
 * Time: 15:04
 */

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

2、进入目录:E:/wwwroot/creditshop/app/Console,执行:./cake hello,报错:Error Shell class HelloShell could not be found. 如图1

进入目录:E:/wwwroot/creditshop/app/Console,执行:./cake hello,报错:Error Shell class HelloShell could not be found.

图1

PS E:/wwwroot/creditshop/app/Console> ./cake hello

Error: Shell class HelloShell could not be found.
#0 E:/wwwroot/creditshop/lib/Cake/Console/ShellDispatcher.php(200): ShellDispatcher->_getShell('hello')
#1 E:/wwwroot/creditshop/lib/Cake/Console/ShellDispatcher.php(66): ShellDispatcher->dispatch()
#2 E:/wwwroot/creditshop/app/Console/cake.php(47): ShellDispatcher::run(Array)
#3 {main}

3、参考网址:https://stackoverflow.com/questions/10671634/cakephp-shell-shell-class-helloshell-could-not-be-found ,如图2

参考网址:https://stackoverflow.com/questions/10671634/cakephp-shell-shell-class-helloshell-could-not-be-found

图2

4、进入目录:E:/wwwroot/creditshop/app,执行:Console/cake hello,未再报错。如图3

进入目录:E:/wwwroot/creditshop/app,执行:Console/cake hello,未再报错。

图3

PS E:/wwwroot/creditshop/app> Console/cake hello


Welcome to CakePHP v2.6.4 Console
---------------------------------------------------------------
App : app
Path: E:/wwwroot/creditshop/app/
---------------------------------------------------------------
Hello world.

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/250648.html

(0)
上一篇 2022年5月1日
下一篇 2022年5月1日

相关推荐

发表回复

登录后才能评论