当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::toString方法代码示例

本文整理汇总了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());
 }
开发者ID:rajanlamic,项目名称:IntTest,代码行数:8,代码来源:RequestTest.php

示例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);
 }
开发者ID:Tigerlee1987,项目名称:modules.zendframework.com,代码行数:11,代码来源:InvalidDataException.php

示例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');
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:21,代码来源:Core.php

示例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();
开发者ID:RodrigoAngeloValentini,项目名称:curso-zf2,代码行数:30,代码来源:request.php


注:本文中的Zend\Http\Request::toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。