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

      1. 如何使用 cron 作业运行 php 文件

        how to run php file using cron jobs(如何使用 cron 作业运行 php 文件)

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

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

                  <tbody id='GIqkC'></tbody>
                <legend id='GIqkC'><style id='GIqkC'><dir id='GIqkC'><q id='GIqkC'></q></dir></style></legend>

                  <bdo id='GIqkC'></bdo><ul id='GIqkC'></ul>
                  本文介绍了如何使用 cron 作业运行 php 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我每天都使用 cron 作业在 php 页面上运行电子邮件计划.当我使用链接运行页面时,php 代码运行良好.

                  现在,当我使用 cron 作业运行 php 脚本时,它也可以正常工作,但是当我进行一些查询时,cron 作业将无法理解链接.

                  例如:http://www.wetube.org/cron.php?id=01001 所以现在如果我尝试每天使用 cron 作业运行它,它就行不通了.>

                  但如果我们只是删除查询它工作正常.你们知道让这个链接在 cron 工作中工作的任何代码吗?

                  解决方案

                  Cron 运行命令就像它们通过 shell 运行一样,因此运行 PHP 将使用本地路径.

                  您需要使用如下命令:

                  php/home/USER/public_html/cron.php

                  或者如果需要包含查询字符串,请改用 cURL(如果已安装):

                  curl http://www.wetube.org/cron.php?id=01001

                  您可能想考虑不要将您的 cron 脚本暴露在互联网上 - 将它们移到您的网络目录之外,因为如果有人发现它,他们可以不断地重新加载它以向您的 cron 脚本发送垃圾邮件(即发送大量电子邮件)

                  I have a E-mail schedule runs everyday on php page using cron jobs. The php code workds fine when i run the page using a link.

                  Now when I run the php script using cron jobs, it also works fine but when I put some query the cron jobs won't understand the link.

                  for example: http://www.wetube.org/cron.php?id=01001 so now if I try to run this everyday using cron job it's doesn't work.

                  But if we just erase the query it works fine. Do you guys know any code which makes this link work in cron job?

                  解决方案

                  Cron runs commands as they would be ran via the shell, so running PHP would use local paths.

                  You need to use a command like:

                  php /home/USER/public_html/cron.php

                  Or if including the query string is necessary, use cURL instead (if it's installed):

                  curl http://www.wetube.org/cron.php?id=01001

                  You might want to look at not exposing your cron scripts to the internet - move them to outside your web directory because if someone finds it they can constantly reload it to spam your cron scripts (i.e. sending lots of emails)

                  这篇关于如何使用 cron 作业运行 php 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)
                      <tbody id='vkte3'></tbody>
                    <legend id='vkte3'><style id='vkte3'><dir id='vkte3'><q id='vkte3'></q></dir></style></legend>

                      <tfoot id='vkte3'></tfoot>
                    • <small id='vkte3'></small><noframes id='vkte3'>

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