本文整理汇总了PHP中WebRequest::getResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP WebRequest::getResponse方法的具体用法?PHP WebRequest::getResponse怎么用?PHP WebRequest::getResponse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebRequest
的用法示例。
在下文中一共展示了WebRequest::getResponse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle500
/**
* The failover stub. Handles the application fault
*
* @param Exception $e uncaught exception that caused fault
* @return void
*/
protected function handle500(Exception $e)
{
$response = $this->request->getResponse();
$response->setStatus(new HttpStatus(HttpStatus::CODE_500));
$clname = get_class($e);
$out = <<<EOT
\t<h1>Internal Server Error</h1>
\t{$clname} : {$e->getMessage()}
\t<hr />
\t<h2>Call Stack</h2>
\t<pre>{$e->getTraceAsString()}</pre>
EOT;
$response->write($out)->finish();
if (defined('BUGS_EMAIL')) {
$this->notify500(BUGS_EMAIL, $e);
}
}
示例2: processResult
/**
* Runs the proccess of handing the action method result
*
* @param IActionResult $actionResult
*
* @return void
*/
protected function processResult(IActionResult $actionResult)
{
$actionResult->handleResult($this->request->getResponse());
}
示例3: WebRequest
<?php
$url = 'http://www.360doc.com/content/15/0918/21/12146850_499980507.shtml#';
$request = new WebRequest($url);
echo '<pre>';
$obj = $request->getResponse();
//var_dump($obj);
// echo $obj->content;
class WebRequest
{
var $url = '';
var $host = '';
var $port = 80;
var $path = '/';
var $method = '';
var $postdata = '';
var $cookies = array();
var $accept = 'text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,image/jpeg,image/gif,*/*';
var $accept_language = 'zh-cn';
var $accept_encoding = 'gzip';
// var $user_agent = 'ErikClient/1.0';
var $user_agent = 'Mozilla/5.0 (Windows NT 5.1; rv:22.0) Gecko/20100101 Firefox/22.0';
var $use_gzip = false;
var $username;
var $password;
var $timeout = 20;
/**
* 构造函数
* @public
* @param <string> $url 请求地址
* @param <string> $method 请求方式