codeigniter - Carry out function only from localhost -
i want set cronjob on plesk. have insert controller , function name.
if knows link, carry out cronjob everytime.
how can ensure, localhost carry out function.
cron jobs run php command line (especially if set use php-cli rather php - web host may able one). however, it's worth noting web hosts set crons run php.
in case, set condition check script being called command line. example:
public function index() {     if(is_cli())     {        // script has been called command line     }     else     {        show_404();     } } in case, if call isn't command line, see 404 error page. is_cli() codeigniter function; more information on in the user guide
Comments
Post a Comment