2
How to execute a class method in Codeigniter via Cronjob?
Ex: main.php accessed in http://www.meusite.com.br/principal/listaCron
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Principal extends CI_Controller {
public function __construct()
{
parent::__construct();
//Load Dependencies
}
public function listaCron()
{
file_put_contents("teste.txt", "Crontab executado em: ".date(‘d/m/Y H:i’));
}
}