(Yaf >=1.0.0)
Yaf_Request_Abstract::getServer — 检索 SERVER 变量
检索一个 SERVER 变量。
name变量名。
default当变量未找到时返回的值。
变量的值;如果未找到,则返回 default。
示例 #1 Yaf_Request_Abstract::getServer() 示例
<?php
class IndexController extends Yaf_Controller_Abstract
{
public function indexAction()
{
$request = $this->getRequest();
$host = $request->getServer("HTTP_HOST");
$protocol = $request->getServer("SERVER_PROTOCOL", "HTTP/1.1");
var_dump($host, $protocol);
}
}
?>以上示例的输出类似于:
string(15) "www.example.com" string(8) "HTTP/1.1"