<bdo id='o50ea'></bdo><ul id='o50ea'></ul>

    <tfoot id='o50ea'></tfoot>

    1. <small id='o50ea'></small><noframes id='o50ea'>

      <legend id='o50ea'><style id='o50ea'><dir id='o50ea'><q id='o50ea'></q></dir></style></legend>
      <i id='o50ea'><tr id='o50ea'><dt id='o50ea'><q id='o50ea'><span id='o50ea'><b id='o50ea'><form id='o50ea'><ins id='o50ea'></ins><ul id='o50ea'></ul><sub id='o50ea'></sub></form><legend id='o50ea'></legend><bdo id='o50ea'><pre id='o50ea'><center id='o50ea'></center></pre></bdo></b><th id='o50ea'></th></span></q></dt></tr></i><div id='o50ea'><tfoot id='o50ea'></tfoot><dl id='o50ea'><fieldset id='o50ea'></fieldset></dl></div>
    2. 通过 crontab 一个变量并从 PHP 读取它?

      pass crontab a variable and read it from PHP?(通过 crontab 一个变量并从 PHP 读取它?)

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

            <legend id='oGheF'><style id='oGheF'><dir id='oGheF'><q id='oGheF'></q></dir></style></legend>
              <tbody id='oGheF'></tbody>
              • 本文介绍了通过 crontab 一个变量并从 PHP 读取它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我创建了一个 crontab 规则:

                I have created a crontab rule:

                * * * * * php/my/directory/file.php

                我想从这个 crontab 传递一个要在 file.php 中使用的变量.

                I want to pass a variable to be used in the file.php from this crontab.

                这样做的最佳方法是什么?

                What is the best method to do this?

                推荐答案

                请记住,在 shell 中运行 PHP 与在 Web 服务器环境中运行完全不同.如果你之前没有做过命令行编程,你可能会遇到一些惊喜.

                Bear in mind that running PHP from the shell is completely different from running it in a web server environment. If you haven't done command-line programming before, you may run into some surprises.

                也就是说,将信息传递到命令中的常用方法是将其放在命令行中.如果你这样做:

                That said, the usual way to pass information into a command is by putting it on the command line. If you do this:

                 php /my/directory/file.php "some value" "some other value"
                

                然后在你的脚本中,$argv[1] 将被设置为 "some value"$argv[2] 将被设置为设置为 其他值".($argv[0] 将被设置为 "/my/directory/file.php").

                Then inside your script, $argv[1] will be set to "some value" and $argv[2] will be set to "some other value". ($argv[0] will be set to "/my/directory/file.php").

                这篇关于通过 crontab 一个变量并从 PHP 读取它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                Is PHP or PHP based web framework stateful or stateless?(PHP 或基于 PHP 的 Web 框架是有状态的还是无状态的?)
                How to parse django style template tags(如何解析 django 样式模板标签)
                What is a good setup for editing PHP in Emacs?(在 Emacs 中编辑 PHP 的好设置是什么?)
                How to check whether specified PID is currently running without invoking ps from PHP?(如何在不从 PHP 调用 ps 的情况下检查指定的 PID 当前是否正在运行?)
                What#39;s the difference between escapeshellarg and escapeshellcmd?(escapeshellarg 和escapeshellcmd 有什么区别?)
                php in background exec() function(php 后台 exec() 函数)
                    <tbody id='RRocM'></tbody>
                  • <bdo id='RRocM'></bdo><ul id='RRocM'></ul>

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

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

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