您的位置:首页 > 编程语言 > PHP开发

Thinkphp 3.2.1 使用CronRunBehavior.class.php

2015-01-05 14:46 459 查看
在项目名/Common/  新建文件夹Cron,并在该文件下新建要执行的php文件。如test.php   <?php echo "test cronrun";?>
在项目名/Common/conf下新建crons.php  
<?php 	 return array(
'cron_1' => array('test', 5), //这里的意思是每隔5秒,执行一次test.php文件
);
?>


tags.php  
<?php	return array(
'app_begin'=>array('Behavior\CronRunBehavior'), // 定时任务,thinkphp固定名称,不可以改变
);


现在就可以了,我的报错 Class 'Behavior\Log' not found  55行   Log::write(implode('',$log)); 改为    \Think\Log::write(implode('',$log));就可以看到结果啦!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐