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

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

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

        Cronjob 但对于 jQuery/Javascript

        Cronjob but for jQuery/Javascript(Cronjob 但对于 jQuery/Javascript)
          <bdo id='hR06J'></bdo><ul id='hR06J'></ul>

            <tbody id='hR06J'></tbody>

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

                1. 本文介绍了Cronjob 但对于 jQuery/Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试开发一个主要使用 PHP 的 Web 应用程序,但我正在使用 jQuery/Javascript 从他们的 URL 中获取人们的推文:http://twitter.com/status/user_timeline/joebloggs.json?count=1&callback=?

                  I'm trying to develop a web application that mainly uses PHP but i'm using jQuery/Javascript to grab people's Tweets from their URL: http://twitter.com/status/user_timeline/joebloggs.json?count=1&callback=?

                  想要运行一个 PHP cron 作业来获取已注册我的应用程序的人的最新推文.但我不知道如何用 javascript 做到这一点?

                  The thing is want to run a PHP cron job to grab latest tweets from people who have signed up for my application. But i dont know how to do this with javascript?

                  这可能吗?

                  这是 javascript 代码,我可以在 PHP 中执行此操作以便我可以使用 Cron 作业吗?

                  This is the javascript code, can i do this in PHP so i can use a Cron Job?

                      $(document).ready( function() {
                  
                          var url = "http://twitter.com/status/user_timeline/joebloggs.json?count=1&callback=?";
                          $.getJSON(url,
                          function(data){
                              $.each(data, function(i, item) {
                                  $("#twitter-posts").append("<p>" + item.text.linkify() + " <span class='created_at'>" + relative_time(item.created_at) + " via " + item.source + "</span></p>");
                              });
                          });
                      });
                  
                      String.prototype.linkify = function() {
                          return this.replace(/[A-Za-z]+://[A-Za-z0-9-_]+.[A-Za-z0-9-_:%&?/.=]+/, function(m) {
                      return m.link(m);
                    });
                   }; 
                    function relative_time(time_value) {
                        var values = time_value.split(" ");
                        time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3];
                        var parsed_date = Date.parse(time_value);
                        var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
                        var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
                        delta = delta + (relative_to.getTimezoneOffset() * 60);
                  
                        var r = '';
                        if (delta < 60) {
                          r = 'a minute ago';
                        } else if(delta < 120) {
                          r = 'couple of minutes ago';
                        } else if(delta < (45*60)) {
                          r = (parseInt(delta / 60)).toString() + ' minutes ago';
                        } else if(delta < (90*60)) {
                          r = 'an hour ago';
                        } else if(delta < (24*60*60)) {
                          r = '' + (parseInt(delta / 3600)).toString() + ' hours ago';
                        } else if(delta < (48*60*60)) {
                          r = '1 day ago';
                        } else {
                          r = (parseInt(delta / 86400)).toString() + ' days ago';
                        }
                  
                        return r;
                  }
                  function twitter_callback ()
                  {
                      return true;
                  }
                  

                  推荐答案

                  最好的解决方案是在 PHP 中重新实现您的功能:

                  The best solution is to re-implement your functionality in PHP:

                  <?    
                  $url = "http://twitter.com/status/user_timeline/joebloggs.json?count=1&callback=?";
                  $responseJsonString = file_get_contents($url);
                  $responseArray = json_decode($responseJsonString, $array=true);
                  
                  // uncomment this to see what's in the response array:
                  // print_r($responseArray);
                  // Now, you can do as you like with $responseArray
                  

                  然后通过 crontab 执行 PHP 脚本.

                  And then execute the PHP script via crontab.

                  这篇关于Cronjob 但对于 jQuery/Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)

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

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

                      <bdo id='umEyO'></bdo><ul id='umEyO'></ul>
                      • <tfoot id='umEyO'></tfoot>