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

        <legend id='wtDxE'><style id='wtDxE'><dir id='wtDxE'><q id='wtDxE'></q></dir></style></legend>

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

        通过 cron 执行 PHP - 未指定输入文件

        Execute PHP via cron - No Input file specified(通过 cron 执行 PHP - 未指定输入文件)

          <tfoot id='bzRQa'></tfoot>
            <bdo id='bzRQa'></bdo><ul id='bzRQa'></ul>
              <tbody id='bzRQa'></tbody>

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

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

                <legend id='bzRQa'><style id='bzRQa'><dir id='bzRQa'><q id='bzRQa'></q></dir></style></legend>

                1. 本文介绍了通过 cron 执行 PHP - 未指定输入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用以下命令通过 cron 执行 PHP 文件

                  I'm using the following command to execute a PHP file via cron

                  php -q /home/seilings/public_html/dvd/cron/mailer.php
                  

                  问题是我有一个包含在执行中的文件,该文件确定要加载的配置....例如:

                  The problem is that I Have a file that's included in the execution that determines which config to load.... such as the following:

                  if (!strstr(getenv('HTTP_HOST'), ".com")) {
                      $config["mode"] = "local";
                  } else {
                      $config["mode"] = "live";
                  }
                  

                  cron 正在加载本地配置,而它应该加载实时配置.我试过使用文件的 http://URL 而不是绝对路径,但没有找到该文件.我是否需要更改命令以使用其中的 URL?

                  The cron is loading the LOCAL config when it should be loading the LIVE config. I've tried using the http:// URL to the file instead of the absolute path but it didn't find the file. Do I need to change the command to use a URL within it?

                  推荐答案

                  使用这个 php_sapi_name() 检查脚本是否在命令行上被调用:

                  Use this php_sapi_name() to check if the script was called on commandline:

                  if (php_sapi_name() === 'cli' OR !strstr(getenv('HTTP_HOST'), ".com")) {
                      $config["mode"] = "local";
                  } else {
                      $config["mode"] = "live";
                  }
                  

                  如果您想在命令行上使用live",请使用以下代码:

                  If you want to use "live" on the commandline use this code:

                  if (php_sapi_name() === 'cli' OR strstr(getenv('HTTP_HOST'), ".com")) {
                      $config["mode"] = "live";
                  } else {
                      $config["mode"] = "local";
                  }
                  

                  这篇关于通过 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 的问题)

                      <bdo id='YHAYJ'></bdo><ul id='YHAYJ'></ul>
                      <legend id='YHAYJ'><style id='YHAYJ'><dir id='YHAYJ'><q id='YHAYJ'></q></dir></style></legend>
                        <tbody id='YHAYJ'></tbody>

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

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