• <legend id='xWLLP'><style id='xWLLP'><dir id='xWLLP'><q id='xWLLP'></q></dir></style></legend>
      <i id='xWLLP'><tr id='xWLLP'><dt id='xWLLP'><q id='xWLLP'><span id='xWLLP'><b id='xWLLP'><form id='xWLLP'><ins id='xWLLP'></ins><ul id='xWLLP'></ul><sub id='xWLLP'></sub></form><legend id='xWLLP'></legend><bdo id='xWLLP'><pre id='xWLLP'><center id='xWLLP'></center></pre></bdo></b><th id='xWLLP'></th></span></q></dt></tr></i><div id='xWLLP'><tfoot id='xWLLP'></tfoot><dl id='xWLLP'><fieldset id='xWLLP'></fieldset></dl></div>

      <tfoot id='xWLLP'></tfoot>

        • <bdo id='xWLLP'></bdo><ul id='xWLLP'></ul>
      1. <small id='xWLLP'></small><noframes id='xWLLP'>

        不使用 CRON 调度脚本

        Schedule scripts without using CRON(不使用 CRON 调度脚本)

        <i id='OB8Fz'><tr id='OB8Fz'><dt id='OB8Fz'><q id='OB8Fz'><span id='OB8Fz'><b id='OB8Fz'><form id='OB8Fz'><ins id='OB8Fz'></ins><ul id='OB8Fz'></ul><sub id='OB8Fz'></sub></form><legend id='OB8Fz'></legend><bdo id='OB8Fz'><pre id='OB8Fz'><center id='OB8Fz'></center></pre></bdo></b><th id='OB8Fz'></th></span></q></dt></tr></i><div id='OB8Fz'><tfoot id='OB8Fz'></tfoot><dl id='OB8Fz'><fieldset id='OB8Fz'></fieldset></dl></div>
      2. <small id='OB8Fz'></small><noframes id='OB8Fz'>

            <tfoot id='OB8Fz'></tfoot>
              • <bdo id='OB8Fz'></bdo><ul id='OB8Fz'></ul>
              • <legend id='OB8Fz'><style id='OB8Fz'><dir id='OB8Fz'><q id='OB8Fz'></q></dir></style></legend>
                  <tbody id='OB8Fz'></tbody>
                • 本文介绍了不使用 CRON 调度脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我知道有很多关于使用 CRON 运行 php 文件的帖子.但是,在共享托管的世界中,并且易于用户设置,我不想搞砸.

                  I know there are many posts about using CRON to run a php file. But, in the world of shared hosting, and ease of setup for a user, I don't want to have to mess with that.

                  我在网上找到了另一个与套接字有关的解决方案.只是想让每个人都接受这个,并告诉我这是一个好主意还是坏主意.听起来效果不错.

                  I found another solution online that has to do with sockets. Just wanted to get everyones take on this, and tell me if this is a good or bad idea. Sounds like it works well.

                  想法?

                  //Open socket connection to cron.php
                  $socketcon = fsockopen($_SERVER['HTTP_HOST'],80,$errorno,$errorstr,10);
                  if($socketcon) {
                  $socketdata = "GET /cron.php HTTP 1.1
                  Host: ".$_SERVER['HTTP_HOST']."
                  Connection: Close
                  
                  ";
                  fwrite($socketcon,$socketdata);
                  //Normally you would get all the data back with fgets and wait until $socketcon reaches feof.
                  //In this case, we just do this:
                  fclose($socketcon);
                  } else {
                  //something went wrong. Put your error handler here.
                  }
                  

                  cron.php:

                  //This script does all the work.
                  sleep(200);
                  //To prove that this works we will create an empty file here, after the sleep is done.
                  //Make sure that the webserver can write in the directory you're testing this file in.
                  $handle = fopen('test.txt','w');
                  fclose($handle);
                  

                  从博客文章中找到脚本:http://syn.ac/tech/13/creating-php-cronjobs-without-cron-and-php-cli/

                  Found the script from a blog post: http://syn.ac/tech/13/creating-php-cronjobs-without-cron-and-php-cli/

                  推荐答案

                  这不是一个糟糕的方法,但您需要确保通过关闭套接字它不仅仅是在脚本完成之前终止脚本.您可以将套接字设置为非阻塞.

                  It's not a bad method, but you need to ensure that by closing the socket it isn't just terminating the script before it finishes. You can set sockets to non-blocking.

                  我仍然会使用 cron 作业,即使它有点痛苦.

                  I would still use a cron job, even if it is a bit of a pain.

                  这篇关于不使用 CRON 调度脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                      • <bdo id='eOyZn'></bdo><ul id='eOyZn'></ul>

                        <small id='eOyZn'></small><noframes id='eOyZn'>

                        <tfoot id='eOyZn'></tfoot>
                        <i id='eOyZn'><tr id='eOyZn'><dt id='eOyZn'><q id='eOyZn'><span id='eOyZn'><b id='eOyZn'><form id='eOyZn'><ins id='eOyZn'></ins><ul id='eOyZn'></ul><sub id='eOyZn'></sub></form><legend id='eOyZn'></legend><bdo id='eOyZn'><pre id='eOyZn'><center id='eOyZn'></center></pre></bdo></b><th id='eOyZn'></th></span></q></dt></tr></i><div id='eOyZn'><tfoot id='eOyZn'></tfoot><dl id='eOyZn'><fieldset id='eOyZn'></fieldset></dl></div>
                            <tbody id='eOyZn'></tbody>
                          <legend id='eOyZn'><style id='eOyZn'><dir id='eOyZn'><q id='eOyZn'></q></dir></style></legend>