This article is to share the content is the thinkphp framework with Linux crontab write php timing script, the need for friends can refer to
Within PHP, the path to the Curl TP framework is available, and the PHP is set to Crontab
For example, the access address for TP is Http://www.tp.com/index.php?m=admin&c=controller&a=action
Write a PHP, for example tpcrontab.php
The contents are as follows:
<?php $url = ' http://www.tp.com/index.php?m=admin&c=controller&a=action '; $timeout =; $data = Array (); $header = Array (); $ch = Curl_init (); curl_setopt ($ch, Curlopt_ssl_verifypeer, false); Skip certificate Check curl_setopt ($ch, Curlopt_ssl_verifyhost, true); Check that the SSL encryption algorithm exists curl_setopt ($ch, Curlopt_url, $url) from the certificate; curl_setopt ($ch, Curlopt_httpheader, $header); curl_setopt ($ch, Curlopt_post, true); curl_setopt ($ch, Curlopt_postfields, Http_build_query ($data)); curl_setopt ($ch, Curlopt_returntransfer, true); curl_setopt ($ch, Curlopt_timeout, $timeout); Curlopt_timeout sets the maximum number of seconds that curl allows to execute $response = curl_exec ($ch); if ($error =curl_error ($ch)) {die ($error); } Curl_close ($ch); Echo $response;
Reference article: https://bbs.csdn.net/topics/390805964
https://blog.csdn.net/qq_35979073/article/details/79352450