-
StackOverflow 文档
-
codeigniter 教程
-
在 linux 托管服务器上的 codeigniter 中创建 cronjob
-
从 cron 调用 CodeIgniter 控制器
// application/controllers/Company_controller.php
<?php
if(!defined('BASEPATH'))
exit('No direct script access allowed');
class Company_controller extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('companies_model');
}
// cron entry would be something like this:
// 1 1 * * * /usr/bin/php [full path to]/index.php company_controller cronCLI AcmeCorp >/dev/null 2>&1
public function cronCLI($firmName) {
if(php_sapi_name() == 'cli') {
$this->companies_model->doSomeDB_Process($firmName);
} else {
echo 'CLI only';
}
}
}