execute js function by php command line

前端 未结 2 1057
失恋的感觉
失恋的感觉 2021-01-27 12:17

I am working in Codeigniter. I have a view, book.php, with a js file, frontend_book.js, running behind it containing a function to sync the calendar.

Snippet from front

2条回答
  •  無奈伤痛
    2021-01-27 12:57

    if, for what ever reason, you wanted to run this as a cron, and you wanted to maintain the application as it is now (mvc written in php) then you could use a headless browser (such as phantomjs) to hit the desired url from a bash script that is run as a cron. This is a bit convoluted - but it would do what you wanted. - there is even a php package if you wanted to keep it all via php - http://jonnnnyw.github.io/php-phantomjs/

提交回复
热议问题