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

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

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

      <tfoot id='SxznJ'></tfoot>
    1. CronJobs 可以执行包含 Javascript 的 php 吗?如果没有,还有其他选择吗?

      Can CronJobs execute a php containing Javascript ? If No, Any Alternatives?(CronJobs 可以执行包含 Javascript 的 php 吗?如果没有,还有其他选择吗?)
        <legend id='gWavX'><style id='gWavX'><dir id='gWavX'><q id='gWavX'></q></dir></style></legend>
        <i id='gWavX'><tr id='gWavX'><dt id='gWavX'><q id='gWavX'><span id='gWavX'><b id='gWavX'><form id='gWavX'><ins id='gWavX'></ins><ul id='gWavX'></ul><sub id='gWavX'></sub></form><legend id='gWavX'></legend><bdo id='gWavX'><pre id='gWavX'><center id='gWavX'></center></pre></bdo></b><th id='gWavX'></th></span></q></dt></tr></i><div id='gWavX'><tfoot id='gWavX'></tfoot><dl id='gWavX'><fieldset id='gWavX'></fieldset></dl></div>

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

            <tbody id='gWavX'></tbody>

                <bdo id='gWavX'></bdo><ul id='gWavX'></ul>
              • <tfoot id='gWavX'></tfoot>
                本文介绍了CronJobs 可以执行包含 Javascript 的 php 吗?如果没有,还有其他选择吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个 php 文件要作为 cronjob 执行,这个 php 文件包含一些 javascript.

                I have php file that is to be executed as cronjob, this php file contains some javascript.

                我将解释流程:

                1. Php 用于从 DB 检索一些数据(URL 列表).
                2. 对于获取的每个 URL,使用一个 Java 脚本 API.
                3. API 返回的结果 Obj 包含每个 url 的数据.
                4. 然后将数据作为 AJAX 调用发送回 php 文件的每个 url.

                这可以通过 CRON JOBS 实现吗?或者是否有任何方法可以安排 javascript 定期运行,例如 php 的 cron?
                更新:我可以使用 PHP curl 管理对 API 的 javascript 调用,并且 cron 作业正在完美执行.但我认为这不是这个问题的正确解决方案,可能是 Node.Js 是解决方案(我还没有测试过).

                Can this be implemented Via CRON JOBS ? OR Is there any method to schedule javascript to run periodically, like cron for php?
                UPDATE: i could manage the javascript call to API with PHP curl ,And the cron Job is getting executed perfectly. But i dont think it is the correct solution to this question may be Node.Js is the solution(i didnt test it yet).

                推荐答案

                您不能在 Cronjobs 中运行 Javascript,因为 Javascript 是由浏览器运行的.我认为你应该看看 php 中的 curl 来调用 api.

                You can't run Javascript in Cronjobs because Javascript is ran by browsers. I think you should take a look at curl in php to call an api instead.

                http://www.php.net/manual/en/book.curl.php

                这篇关于CronJobs 可以执行包含 Javascript 的 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() 函数)
              • <legend id='aKhxW'><style id='aKhxW'><dir id='aKhxW'><q id='aKhxW'></q></dir></style></legend>

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

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