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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

Python Tornado package error when running server -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -