本文整理汇总了PHP中Zend\Http\Request::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::toString方法的具体用法?PHP Request::toString怎么用?PHP Request::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Http\Request
的用法示例。
在下文中一共展示了Request::toString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRequestCanBeCastToAString
public function testRequestCanBeCastToAString()
{
$request = new Request();
$request->setMethod(Request::METHOD_GET);
$request->setUri('/');
$request->setContent('foo=bar&bar=baz');
$this->assertEquals("GET / HTTP/1.1\r\n\r\nfoo=bar&bar=baz", $request->toString());
}
示例2: fromInvalidRequest
/**
* Generates an Exception from a Invalid Post Request
*
* @param string $publicMessage
* @param Http\Request $request
* @return self
*/
public static function fromInvalidRequest($publicMessage, Http\Request $request)
{
return new self(sprintf('Invalid Request received [%s]', $request->toString()), (string) $publicMessage);
}
示例3: getDispatchServer
/**
* dispatch request
*
* @param \Zend\Http\Request $request
* @return Tinebase_Server_Interface|null
*/
public static function getDispatchServer(\Zend\Http\Request $request)
{
// Test server conditions from server plugins
foreach (self::_getServerPlugins() as $serverPlugin) {
$server = call_user_func_array(array($serverPlugin, 'getServer'), array($request));
if ($server instanceof Tinebase_Server_Interface) {
Tinebase_Core::set('serverclassname', get_class($server));
return $server;
}
}
if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . " Request: " . $request->toString());
}
throw new Tinebase_Exception('No valid server found for request');
}
示例4: Request
/*
GET URI 1.1
HEADERS Content-Type: text/html
BODY -> Conteudo
*/
use Zend\Http\Request;
// Request GET
//$request = new Request();
//$request->setMethod(Request::METHOD_GET);
//$request->setUri("http://google.com");
//$request->setContent("Conteúdo da nossa request");
//
//echo $request->toString();
// POST
//$request = new Request();
//$request->setMethod(Request::METHOD_POST);
//$request->getPost()->set('nome','Wesley');
//$request->getPost()->set('x','10');
//$request->setUri("http://google.com");
//$request->setContent($request->getPost()->toString());
//
//echo $request->toString();
$request = new Request();
$request->setMethod(Request::METHOD_POST);
$request->getPost()->set('nome', 'Wesley');
$request->getHeaders()->addHeaders(array('headerX' => 10, 'headerY' => 20));
$request->getHeaders()->addHeaderLine('Content-Type: text/html');
$request->setUri("http://google.com");
$request->setContent($request->getPost()->toString());
echo $request->toString();