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

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

        <bdo id='gZfQZ'></bdo><ul id='gZfQZ'></ul>
      1. <legend id='gZfQZ'><style id='gZfQZ'><dir id='gZfQZ'><q id='gZfQZ'></q></dir></style></legend>
        <tfoot id='gZfQZ'></tfoot>

        如何使用 Zend 框架 2 运行 cron 作业

        How to run cron job with zend framework 2(如何使用 Zend 框架 2 运行 cron 作业)

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

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

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

                • 本文介绍了如何使用 Zend 框架 2 运行 cron 作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 Zend Framework 2 中构建了应用程序.我想设置 cron 作业来更新我的产品.我知道这样的脚本应该从公共文件夹之外运行,但不幸的是我在 cron 中的脚本需要使用框架文件.
                  我该怎么做?
                  我想出的唯一方法是从公共文件夹外部运行脚本,然后添加一些哈希或密码并重定向到

                  I have application built in Zend Framework 2. I would like to set cron job for updating my products. I know scripts such as this should be run from outside of public folder, but unfortunately my script in cron needs to use framework files.
                  How can I do this?
                  The only way I figured out is to run script from outside of public folder then add some hash or password and redirect to

                  www.domain.com/cron/test
                  

                  所以我将拥有所有框架功能.
                  会安全吗?也许还有其他方法?

                  So I will have all framework functionality.
                  Will it be secure? Maybe there is a other way?

                  推荐答案

                  我强烈建议使用 CLI 来满足此类需求.

                  I strongly recommend to use CLI for such requirement.

                  1. 在应用程序模块中创建一个带有 updateAction() 的 ConsoleController.
                  2. 将控制台路由添加到您的应用程序模块的 module.config.php:

                  1. Create a ConsoleController with an updateAction() inside the application module.
                  2. Add a console route to your application module's module.config.php:

                  array(
                      'router' => array(
                          'routes' => array(
                          ...
                          )
                      ),
                  
                  'console' => array(
                      'router' => array(
                          'routes' => array(
                              'cronroute' => array(
                                  'options' => array(
                                      'route'    => 'updateproducts',
                                      'defaults' => array(
                                          'controller' => 'ApplicationControllerConsole',
                                          'action' => 'update'
                                      )
                                  )
                              )
                          )
                      )
                  )
                  );
                  

                • 现在打开终端

                • Now open the terminal and

                  $ cd /path/to/your/project
                  $ php public/index.php updateproducts
                  

                • 仅此而已.希望有帮助.

                  Thats all. Hope it helps.

                  这篇关于如何使用 Zend 框架 2 运行 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 的问题)

                            <tbody id='c4DwC'></tbody>
                          <tfoot id='c4DwC'></tfoot>

                        • <small id='c4DwC'></small><noframes id='c4DwC'>

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

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

                          • <bdo id='c4DwC'></bdo><ul id='c4DwC'></ul>