本文整理汇总了PHP中Director::extract_request_headers方法的典型用法代码示例。如果您正苦于以下问题:PHP Director::extract_request_headers方法的具体用法?PHP Director::extract_request_headers怎么用?PHP Director::extract_request_headers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Director
的用法示例。
在下文中一共展示了Director::extract_request_headers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExtractRequestHeaders
/**
* @covers Director::extract_request_headers()
*/
public function testExtractRequestHeaders()
{
$request = array('REDIRECT_STATUS' => '200', 'HTTP_HOST' => 'host', 'HTTP_USER_AGENT' => 'User Agent', 'HTTP_ACCEPT' => 'text/html', 'HTTP_ACCEPT_LANGUAGE' => 'en-us', 'HTTP_COOKIE' => 'PastMember=1', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => 'GET', 'REQUEST_URI' => '/', 'SCRIPT_NAME' => FRAMEWORK_DIR . '/main.php', 'CONTENT_TYPE' => 'text/xml', 'CONTENT_LENGTH' => 10);
$headers = array('Host' => 'host', 'User-Agent' => 'User Agent', 'Accept' => 'text/html', 'Accept-Language' => 'en-us', 'Cookie' => 'PastMember=1', 'Content-Type' => 'text/xml', 'Content-Length' => '10');
$this->assertEquals($headers, Director::extract_request_headers($request));
}
示例2: SS_HTTPRequest
<?php
require_once __DIR__ . '/../framework/core/Core.php';
$request = new SS_HTTPRequest($_SERVER['REQUEST_METHOD'], isset($_GET['url']) ? $_GET['url'] : '', $_GET);
$headers = Director::extract_request_headers($_SERVER);
foreach ($headers as $header => $value) {
$request->addHeader($header, $value);
}
$container = Injector::inst();
$session = $container->create('Session', array());
if (Session::request_contains_session_id()) {
$session->inst_start();
}
$container->get('RequestProcessor')->preRequest($request, $session, DataModel::inst());
require_once __DIR__ . '/../framework/main.php';