Home  >  Article  >  Backend Development  >  crontab - Cron execution of PHP files using CI framework

crontab - Cron execution of PHP files using CI framework

WBOY
WBOYOriginal
2016-08-04 09:20:501038browse

To do the project, a certain PHP file needs to be executed every minute to process the data, and the LNMP used cannot be directly accessed through 127.0.0.1
I have never been exposed to Cron before. I searched online and now there are several solutions planned.

  1. Simulate the client to send a request to the domain/path every minute.

  2. Implement the reading, parsing, encapsulation and storage of data into the database without the help of a framework.

I wonder if you have any good ideas? The framework uses CI

Reply content:

To do the project, a certain PHP file needs to be executed every minute to process the data, and the LNMP used cannot be directly accessed through 127.0.0.1
I have never been exposed to Cron before. I searched online and now there are several solutions planned.

  1. Simulate the client to send a request to the domain/path every minute.

  2. Implement the data reading, parsing, encapsulation and storage without using the framework.

I wonder if you have any good ideas? The framework uses CI

Use linux crontabah

##调用PHP文件写法
*/10 * * * * /usr/local/webserver/php/bin/php /www/project/test.com/price.php
##sh写法
*/10 * * * * sh /www/project/test.com/price.sh 
##laravel框架写法
* * * * * /usr/local/php/bin/php /home/project/service.com/artisan  schedule:run
##ThinkPHP框架写法
*/1 * * * * /usr/local/webserver/php/bin/php /www/home/project/dc/cli.php CancelOrder/cancel
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn