本文整理汇总了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;
}