[Yii Framework] Another method to run cron in the share space server.

In fact that I am too poor to buy a server to run my website, but I want to run cron auto, so I use ajax to do it! :P

 

In the file of the layout, add the code as below:

代码
<script type="text/javascript">
$(document).ready(
function(){
$.ajax({
type:
'GET',
url:
"<?php echo Yii::app()->createUrl("/site/cron");?>",
data:
''
});
});
</script>

 

in the path /site/cron, you can write some code to do what you want. :)

 

Have fun with Yii!

posted @ 2010-09-22 23:04  DavidHHuan  阅读(346)  评论(0编辑  收藏  举报