Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/242.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
cakephp shell使用“不工作”_Php_Shell_Cakephp_Plugins_Model - Fatal编程技术网

cakephp shell使用“不工作”

cakephp shell使用“不工作”,php,shell,cakephp,plugins,model,Php,Shell,Cakephp,Plugins,Model,我使用public$uses=array('PluginA.modelclas1')在shell中加载插件模型类。在命令行中运行shell时,出现以下错误: Mac:Console charles$ ./cake PluginA.do_something test CAMPAIGN -c 1 Notice Error: Undefined property: DoSomethingShell::$ModelClass1 in [/Users/charles/Workspace/PHP/Proje

我使用
public$uses=array('PluginA.modelclas1')
在shell中加载插件模型类。在命令行中运行shell时,出现以下错误:

Mac:Console charles$ ./cake PluginA.do_something test CAMPAIGN -c 1
Notice Error: Undefined property: DoSomethingShell::$ModelClass1 in [/Users/charles/Workspace/PHP/ProjectA/lib/Cake/Console/Shell.php, line 443]

PHP Fatal error:  Call to a member function exists() on a non-object in /Users/charles/Workspace/PHP/ProjectA/app/Plugin/PluginA/Console/Command/DoSomethingShell.php on line 91
PHP Stack trace:
PHP   1. {main}() /Users/charles/Workspace/PHP/ProjectA/app/Console/cake.php:0
PHP   2. ShellDispatcher::run() /Users/charles/Workspace/PHP/ProjectA/app/Console/cake.php:37
PHP   3. ShellDispatcher->dispatch() /Users/charles/Workspace/PHP/ProjectA/lib/Cake/Console/ShellDispatcher.php:68
PHP   4. Shell->runCommand() /Users/charles/Workspace/PHP/ProjectA/lib/Cake/Console/ShellDispatcher.php:200
PHP   5. DoSomethingShell->test() /Users/charles/Workspace/PHP/ProjectA/lib/Cake/Console/Shell.php:389

Fatal error: Call to a member function exists() on a non-object in /Users/charles/Workspace/PHP/ProjectA/app/Plugin/PluginA/Console/Command/DoSomethingShell.php on line 91

Call Stack:
    0.0003     228248   1. {main}() /Users/charles/Workspace/PHP/ProjectA/app/Console/cake.php:0
    0.0010     314344   2. ShellDispatcher::run() /Users/charles/Workspace/PHP/ProjectA/app/Console/cake.php:37
    0.0153    2075240   3. ShellDispatcher->dispatch() /Users/charles/Workspace/PHP/ProjectA/lib/Cake/Console/ShellDispatcher.php:68
    0.0201    2416216   4. Shell->runCommand() /Users/charles/Workspace/PHP/ProjectA/lib/Cake/Console/ShellDispatcher.php:200
    0.0262    3250056   5. DoSomethingShell->test() /Users/charles/Workspace/PHP/ProjectA/lib/Cake/Console/Shell.php:389

Fatal Error Error: Call to a member function exists() on a non-object in [/Users/charles/Workspace/PHP/ProjectA/app/Plugin/PluginA/Console/Command/DoSomethingShell.php, line 91]
shell和加载的模型类都在PluginA
PluginA
中。在
modelclas1
中,有一个名为
exists()
的方法


提前谢谢

可能是重复的我尝试了相同的设置,它似乎工作。你能从shell中粘贴更多的代码吗?你是在/app还是/app/Console中?尝试将cd'ing返回到/app并执行/Console/cake PluginA.do_something测试活动-c 1非常感谢您的帮助!在我更新PHP之后,这个问题就消失了。也许我没有正确设置PHP和cakePHP。