當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。