2016-11-09 30 views
2

我有我的貝殼類目錄中的應用程序/殼牌 而cakeShell目錄中的應用程序/軟件/ 所以,當我執行命令 FULLPATH /應用/蛋糕爲了 我得到的錯誤貝殼類orderShell找不到CakePhp2.x在Windows中使用CronJobs

這是我的殼類代碼:

<?php 
namespace app\Shell; 
use Cake\Console\Shell; 

class OrderShell extends Shell { 

     function main() // main needs to define 
     { 
       App::import(‘Component’, ‘BusinessLogic’); 
       $this->BusinessLogic = &new BusinessLogic(); 

       $option = !empty($this->args[0]) ? $this->args[0] : 」; 
       echo ‘Cron started without any issue.’; 

       switch ($option) 
       { 
         case ‘first’: 
         $result= $this->BusinessLogic->first_method(); 
         break; 
         case ‘second’: 
         $result= $this->BusinessLogic->deleteauto(); 
         break; 
         default: 
         echo ‘No Parameters passed .’; 
       } 
     } 
} 

回答

1

CakePHP的2.x的所以在你的文件的頂部namespace語句是最有可能的原因Ø不使用名稱空間你的問題。

另外你不應該在你的shell中導入組件。如果你發現自己需要它,那就意味着功能屬於模型類中。