2017-07-04 40 views

回答

0

有沒有像這樣的的Prestashop核心和模塊,但不管怎麼說,事情可以做簡單:

  • 調用模塊構造函數,所以它每次都會

    $this->mySuperCron(); 
    
    執行
  • 然後存儲時間和執行你的請求之前只檢查時間:

    private function mySuperCron() { 
        $check_time = strtotime('now - 20 minutes'); 
    
        if ((int) Configuration::get('MYSUPERMODULETIMER') < (int) $check_time) { 
         // Make your cron here by either calling functions here or do it with file_get_contents/curl or echo an ajax which will be executed in backoffice 
         Configuration::updateValue('MYSUPERMODULETIMER', (int) $check_time); 
        } 
    
    } 
    
+0

非常感謝您的回覆。 – user3825870

+0

如果是這種情況,不要僞造成答案被接受! –

+0

是啊,你是對的...謝謝 – user3825870