简体   繁体   English

在 cakephp 2 中创建 shell 的问题

[英]Problems creating shell in cakephp 2

I've been following this to create a shell.我一直在关注这个来创建一个 shell。 But I am getting 2 different errors.但我收到了 2 个不同的错误。

Number 1: 1号:

I added a HelloShell.php file inside this path我在此路径中添加了一个 HelloShell.php 文件

C:\xampp\htdocs\digesto\lib\Cake\Console\Command C:\xampp\htdocs\digesto\lib\Cake\Console\Command

The HelloShell.php contains the following code HelloShell.php 包含以下代码

class HelloShell extends AppShell {

    public $uses = array('Norm');

    public function show() {
        $norm = $this->Norm->find('first');
        $this->out(print_r($norm, true));
    }
}

And i get this error while running /Console/cake hello show我在运行 /Console/cake hello show 时收到此错误

Error: Class 'AppModel' not found错误:未找到 Class 'AppModel'

Number 2: 2号:

I added a HelloShell.php file inside this path我在此路径中添加了一个 HelloShell.php 文件

C:\xampp\htdocs\digesto\app\Console\Command C:\xampp\htdocs\digesto\app\Console\Command

Using the same code ase above and I get the following error使用与上面相同的代码,我收到以下错误

Error: Plugin Hello could not be found错误:找不到插件 Hello

What am I doing wrong?我究竟做错了什么?

So far the answer for this question seems to work.到目前为止,这个问题的答案似乎有效。

CakePhp 2.4 "Error: Shell class HelloShell could not be found." CakePhp 2.4“错误:找不到 Shell class HelloShell。” Paths mess? 路径混乱?

Will update if not.没有的话会更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM