相关关键词
关于我们
最新文章
Yii框架创建cronjob定时任务的方法分析
本文实例讲述了Yii框架创建cronjob定时任务的方法。分享给大家供大家参考,具体如下:
1. 添加环境配置
protected/config/console.php
<?php require_once('env.php'); // This is the configuration for yiic console application. // Any writable CConsoleApplication properties can be configured here. return array( 'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..', 'name'=>'CMS Console', // application components 'components'=>array( //Main DB connection 'db'=>array( 'connectionString'=>DB_CONNECTION, 'username'=>DB_USER, 'password'=>DB_PWD, 'enableParamLogging'=>true, ), 'log'=>array( 'class'=>'CLogRouter', 'routes'=>array( array( 'class'=>'CFileLogRoute', 'levels'=>'error, warning', ), ), ), ), );