本文整理匯總了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();
}
}
示例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;
}