本文整理汇总了PHP中Q_Response::batch方法的典型用法代码示例。如果您正苦于以下问题:PHP Q_Response::batch方法的具体用法?PHP Q_Response::batch怎么用?PHP Q_Response::batch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q_Response
的用法示例。
在下文中一共展示了Q_Response::batch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
<?php
/**
* Front controller for Q
*/
include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Q.inc.php';
//
// Handle batch request
//
$urls = Q::ifset($_REQUEST['urls'], array());
Q::log("Batch request for " . count($urls) . " urls");
header("Content-type: application/json");
Q_Response::$batch = true;
echo "[";
$original_request = $_REQUEST;
foreach ($urls as $i => $url) {
$request = parse_url($url);
parse_str($request['query'], $_REQUEST);
$request = explode('?', $url);
echo "[";
if (!empty($request[0])) {
Q_ActionController::execute($request[0]);
}
echo "]";
if (isset($urls[$i + 1])) {
echo ',';
}
}
$_REQUEST = $original_request;
echo "]";
Q::log("~" . ceil(Q::milliseconds()) . 'ms+' . ceil(memory_get_peak_usage() / 1000) . 'kb.' . " batch complete.");