我有一种情况需要在特定的时间实例中在控制器中运行一个函数。例如。我想在这些日期执行它:
$Q1 = 2016-03-31 23:59:59, $Q2 = 2016-06-30 23:59:59, $Q3 = 2016-09-30 23:59:59, $Q4 = 2016-12-31 23:59:59
功能代码如下:
function whenToResetIdGeneratorTable()
{
$db = $this->session->userdata('db');
$labid = 1;
$this->load->model('labbranches');
$labtablename = $this->labbranches->getLabTableName($labid, $db);
$classname;
foreach($labtablename as $index => $arr)
{
foreach($arr as $key => $value){
$classname = $value;
}//end inner loop
} //end outer loop
$this->load->model(''.$classname.'');
$result = $this->$classname->resetTable($db);
echo json_encode($quart1);
}
但我不知道如何在确定正确的日期和时间后定期调用此函数?