Home>Article>Backend Development> How to perform offline tasks in php
This article mainly introduces the method of executing PHP tasks offline, which has a very good reference value. Let’s take a look at it with the editor.
Go directly to the code, the main function
ignore_user_abort(true);
This function ignores that the terminal is closed (the open web page is closed), and the following
getfiles() function is used to perform the collection taskCustom function, and then configure the path
to open the written page and close it. Later, I found that the task can be completed. If you are interested, you can try it.
window.close();'; } //配置需要采集的页面路径数组 $urls = array( 'http://www.cnblogs.com/jianqingwang/p/6373168.html', 'http://www.cnblogs.com/jianqingwang/p/6148644.html', 'http://www.61916.com/news_view_2423.html', 'http://blog.sina.com.cn/s/blog_8e326c350102w1ah.html', 'http://www.w3school.com.cn/php/func_misc_ignore_user_abort.asp', 'http://xinwen.eastday.com/a/170219205305597.html', 'http://society.huanqiu.com/article/2017-02/10162630.html?from=bdwz', 'http://www.cankaoxiaoxi.com/roll10/bd/20170220/1699670.shtml', 'http://news.china.com/socialgd/10000169/20170220/30266284.html', 'http://news.k618.cn/society/201702/t20170220_10368740.html', 'http://fj.qq.com/a/20170218/029521.htm' ); //遍历数组 foreach($urls as $key=>$val){ getfiles($val,$key); } ?>
The above is the detailed content of How to perform offline tasks in php. For more information, please follow other related articles on the PHP Chinese website!