当前位置: 首页>>代码示例>>PHP>>正文


PHP http::no_content方法代码示例

本文整理汇总了PHP中http::no_content方法的典型用法代码示例。如果您正苦于以下问题:PHP http::no_content方法的具体用法?PHP http::no_content怎么用?PHP http::no_content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在http的用法示例。


在下文中一共展示了http::no_content方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: on_shutdown

 function on_shutdown()
 {
     global $pending;
     // we were waiting for changes, and this is an internal error
     if ($pending && !headers_sent()) {
         http::no_content();
     }
 }
开发者ID:rair,项目名称:yacs,代码行数:8,代码来源:thread.php

示例2: while

 /**
  * wait for updates
  *
  * This script will wait for new updates before providing them to caller.
  * Because of potential time-outs, you have to care of retries.
  *
  * @param string reference to thread (e.g., 'article:123')
  * @param string timestamp of previous update
  * @return array attributes including new comments and a timestamp
  *
  * @see articles/view_as_chat.php
  * @see comments/thread.php
  */
 public static function &pull($anchor, $stamp, $count = 100)
 {
     global $context;
     $timer = 1;
     // some implementations will kill network connections earlier anyway
     Safe::set_time_limit(max(30, $timer));
     // we return formatted text
     $text = '';
     // sanity check
     if (!$anchor) {
         return $text;
     }
     // the query to get time of last update
     $query = "SELECT edit_date, edit_name FROM " . SQL::table_name('comments') . " AS comments " . " WHERE comments.anchor LIKE '" . SQL::escape($anchor) . "'" . " ORDER BY comments.edit_date DESC" . " LIMIT 1";
     // we may timeout ourself, to be safe with network resources
     while (!($stat = SQL::query_first($query)) || isset($stat['edit_date']) && $stat['edit_date'] <= $stamp) {
         // kill the request to avoid repeated transmissions when nothing has changed
         if (--$timer < 1) {
             http::no_content();
             die;
         }
         // preserve server resources
         sleep(1);
     }
     // return an array of variables
     $response = array();
     $response['items'] =& Comments::list_by_thread_for_anchor($anchor, 0, $count, 'thread');
     $response['name'] = strip_tags($stat['edit_name']);
     $response['timestamp'] = SQL::strtotime($stat['edit_date']);
     // return by reference
     return $response;
 }
开发者ID:rair,项目名称:yacs,代码行数:45,代码来源:comments.php


注:本文中的http::no_content方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。