本文整理汇总了PHP中HttpResponse::send方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpResponse::send方法的具体用法?PHP HttpResponse::send怎么用?PHP HttpResponse::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpResponse
的用法示例。
在下文中一共展示了HttpResponse::send方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
if ($this->_isRequestMatching()) {
$this->_controller = $this->_getControllerInstance();
$this->_response->setBody($this->_callAction());
$this->_response->send();
}
}
示例2: test_HttpResponse
/**
* Test HttpResponse.
*/
function test_HttpResponse()
{
HttpResponse::setCache(true);
HttpResponse::setContentType('application/pdf');
HttpResponse::setContentDisposition("test.pdf", false);
HttpResponse::setFile('sheet.pdf');
HttpResponse::send();
}
示例3: UrlFactory
$request->langue = $response->langue = $userLangue;
define('LANGUE', $request->langue->code);
define('BASE_URL_LANGUE', BASE_URL . $request->langue->code . '/');
ini_set('default_charset', CHARSET);
setlocale(LC_TIME, $request->langue->locale . '.' . mb_strtolower(CHARSET));
if (in_array('translations', $backoModules) && file_exists(ROOT . 'traductions.inc.php')) {
Translator::init($request->langue->code, DEFAULT_LANG);
}
require_once APPLICATION_ROOT . 'UrlFactory.php';
UrlSingleton::init(new UrlFactory(), $request->langue);
if (in_array('admins', $allowedModules) && (empty($_SESSION['admin']) || !($admin = DBFactory::get('admins')->get($_SESSION['admin'])) instanceof Admin) && $request->url != UrlFactory::module('admins', 'login') && $request->url != UrlFactory::module('admins', 'init')) {
Header::location(UrlFactory::module('admins', 'login'));
}
try {
if (!file_exists($file = APPLICATION_MODULES . $request->module . DS . $request->controller . '.php')) {
throw new Error404Exception($response);
}
require $file;
$controller = new $request->controller($response);
Logger::addPhpLog($request);
if (!method_exists($controller, $request->method)) {
throw new Error404Exception($response);
}
$controller->handleRequest($request);
} catch (Error404Exception $exception) {
require APPLICATION_MODULES . 'errors' . DS . 'ErrorsController.php';
$controller = new ErrorsController($response);
$controller->get404();
}
$response->send($request);
示例4: actionLongPoller
public function actionLongPoller()
{
$model = new LongPoller();
//$request = http_get_request_body();
$request = json_encode(array("deviceID" => "90:C1:15:BC:97:4F", "orderNo" => "1"));
$model->decodeStatusRequest($request);
$model->checkStatus();
$responseMsg = $model->generateResponse();
HttpResponse::status(200);
HttpResponse::setContentType('application/json');
HttpResponse::setData($responseMsg);
HttpResponse::send();
}
开发者ID:nsawant942,项目名称:Canteen-Management-Software-System--Witwatersrand,代码行数:13,代码来源:MobileController.php
示例5: route
/**
* route
*
* @access public
* @return void
*/
public function route()
{
global $app;
$controllerName = $this->_command->getControllerName();
if (!$this->routeExists($controllerName)) {
$controllerName = 'error';
}
include 'controllers/' . $controllerName . '.php';
// Only log analytics data for non-login pages here
if (strcasecmp($controllerName, 'login') !== 0) {
if ($app->getConfiguration()->logAnalytics() == true) {
$analyticsData = array();
$analyticsData['time'] = time();
$analyticsData['session'] = session_id();
$analyticsData['page'] = $controllerName;
$GLOBALS['routeLogger']->info(json_encode($analyticsData));
}
}
$controllerClass = $controllerName . 'Controller';
$controller = new $controllerClass($this->_command);
//$controller->addPreProcessor();
try {
$params = $controller->getParams();
$request = new HttpRequest($params);
$request->parse();
$controller->execute($request);
} catch (MissingParamsException $mpe) {
$response = new HttpResponse();
$response->addHeader('HTTP/1.1 400 Bad Request');
$response->send();
} catch (ServiceException $sxe) {
$response = new HttpResponse();
$response->sendError($sxe->getMessage());
} catch (ClientException $cxe) {
$response = new HttpResponse();
$response->sendError($cxe->getMessage(), $cxe->getCode());
}
}
示例6: phpSerial
$serial = new phpSerial();
$serial->deviceSet("/dev/ttyACM0");
$serial->confBaudRate(9600);
$serial->confParity("none");
$serial->confCharacterLength(8);
$serial->confStopBits(1);
$serial->deviceOpen();
// arduino requires a 2 second delay in order to receive the message
sleep(2);
// Si c'est une request hi on allumera la led
$data = $_GET["hi"];
$serial->sendMessage($data);
$read[$cnt] = $serial->readPort();
while (substr($read[$cnt], -1, 1) != "a") {
$cnt++;
$read[$cnt] = $serial->readPort();
}
for ($i = 1; $i < $cnt + 1; $i++) {
$rcv = $rcv . $read[$i];
}
$rcv = rtrim($rcv, "a");
// Si c'est une request temperature on renvoiera la température (voir index.php pour le retour de valeur)
// afficher température sur le bobox
// Si c'est une request heure on affiche l'heure sur le bobox (pas besoin sur téléphone
// Variation de lumière -> quelqun dans la piece ! notification téléphone ? a voir...
HttpResponse::setCache(true);
HttpResponse::setContentType('text/plain');
HttpResponse::setData($rcv);
HttpResponse::send();
$serial->deviceClose();
}