本文整理汇总了PHP中Header类的典型用法代码示例。如果您正苦于以下问题:PHP Header类的具体用法?PHP Header怎么用?PHP Header使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Header类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHeader
protected function getHeader()
{
$header = new Header();
$header->title = $this->title;
$header->meta("Content-Type", "text/html; charset=utf-8", true);
$header->meta("description", $this->meta_desc, false);
$header->meta("keywords", $this->meta_key, false);
$header->meta("viewport", "width=device-width", false);
$header->favicon = "/favicon.ico";
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 8.0')) {
$header->css = array("/styles/main.css", "/styles/prettify.css", "/styles/unite-gallery.css", "/styles/ie.css");
} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Safari/525.29')) {
$header->css = array("/styles/main.css", "/styles/prettify.css", "/styles/unite-gallery.css", "/styles/safari3.css");
} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7.0')) {
$header->css = array("/styles/reject.css");
} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.0')) {
$header->css = array("/styles/reject.css");
} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5.5')) {
$header->css = array("/styles/reject.css");
} else {
$header->css = array("/styles/main.css", "/styles/prettify.css", "/styles/unite-gallery.css");
}
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7.0')) {
$header->js = array("/js/reject.min.js");
} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.0')) {
$header->js = array("/js/reject.min.js");
} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5.5')) {
$header->js = array("/js/reject.min.js");
} else {
$header->js = array("/js/jquery-11.0.min.js", "/js/functions.js", "/js/validator.js", "/js/prettify.js", "/js/unitegallery.min.js", "/js/ug-theme-compact.js");
}
return $header;
}
示例2: invokeHandler
public function invokeHandler(Smarty $viewModel, Header $header, $f, $page)
{
$header->title('PayPic');
$header->import('jqgeeks/bootstrap_css', 'mypage');
$viewModel->assign("pname", "@RTPic");
return self::showLatest($viewModel);
}
示例3: getHandshake
public function getHandshake($buffer) {
$header = new Header($buffer);
$params = $header->getParams();;
if (isset($params['Sec-WebSocket-Key'])) {
$response = "HTTP/1.1 101 Switching Protocols\r\n";
$response .= "Upgrade: websocket\r\n";
$response .= "Connection: Upgrade\r\n";
$response .= "Sec-WebSocket-Accept: $acceptKey";
$response .= "\0";
}
else {
$pattern = '/[^\d]*/';
$replacement = '';
$numkey1 = preg_replace($pattern, $replacement, $params['Sec-WebSocket-Key1']);
$numkey2 = preg_replace($pattern, $replacement, $params['Sec-WebSocket-Key2']);
$pattern = '/[^ ]*/';
$replacement = '';
$spaces1 = strlen(preg_replace($pattern, $replacement, $params['Sec-WebSocket-Key1']));
$spaces2 = strlen(preg_replace($pattern, $replacement, $params['Sec-WebSocket-Key2']));
$hashData = md5( pack("N", $numkey1/$spaces1) . pack("N", $numkey2/$spaces2) . $header->getMessage(), true);
$response = "HTTP/1.1 101 WebSocket Protocol Handshake\r\n";
$response .= "Upgrade: WebSocket\r\n";
$response .= "Connection: Upgrade\r\n";
$response .= "Sec-WebSocket-Origin: " . $params['Origin'] . "\r\n";
$response .= "Sec-WebSocket-Location: ws://" . "{$this->address}:{$this->port}" . $header->getResource() . "\r\n";
$response .= "\r\n";
$response .= $hashData;
$response .= "\0";
}
return $response;
}
示例4: parseHeader
function parseHeader()
{
if (!empty($this->header)) {
return;
}
$this->header = new Header($this);
$this->header->parse();
}
示例5: testToArray
/**
* Test the conversion of the header to an array
*/
public function testToArray()
{
$key = 'somekey';
$algorithm = 'H256';
$type = 'mytype';
$header = new Header($key, $algorithm, $type);
$this->assertEquals($header->toArray(), array('typ' => $type, 'alg' => $algorithm));
}
示例6: format
/**
* @return string
*/
public function format()
{
$lines = '';
foreach ($this->lines as $line) {
$lines .= $line->format() . PHP_EOL;
}
return ($this->hasHeader() ? $this->header->format() . PHP_EOL : '') . trim($lines) . PHP_EOL;
}
示例7: addHeadersStr
public function addHeadersStr($arr)
{
foreach ($arr as $key => $str) {
$header = new Header();
$header->setContent($str);
$this->addHeader($header);
}
}
示例8: test
/**
* Runs the test.
*/
public function test()
{
$name = 'Organization';
$value = 'Jyxo';
// Email and name given
$header = new Header($name, $value);
$this->assertEquals($name, $header->getName());
$this->assertEquals($value, $header->getValue());
}
示例9: invokeHandler
public function invokeHandler(Smarty $viewModel, Header $header, $f, $page, $aid)
{
$header->title('PayPic');
$header->import('picbootstrap', 'mypage');
$viewModel->assign("pname", "@RTPic");
$album = new Album($aid);
$viewModel->assign("images", $album->getImges());
return "images";
}
示例10: invokeHandler
public function invokeHandler(Smarty $viewModel, Header $header, $f, $page)
{
$header->title('PayPic');
$header->import('jqgeeks/bootstrap_css', 'mypage');
$viewModel->assign("pname", "@RTPic");
global $RDb;
$imageAccess = $RDb->fetchAll("select * from file_access fa,files f,user u" . " where fa.pid=f.id and u.uid=fa.uid");
$viewModel->assign("images", $imageAccess);
return "imageAccess";
}
示例11: invokeHandler
public function invokeHandler(Smarty $viewModel, Header $header, $f, $page, $pid)
{
$header->title('PayPic');
$header->import('jqgeeks/bootstrap_css', 'mypage');
$viewModel->assign("pname", "@RTPic");
global $RDb;
$image = $RDb->fetch("select * from files where id=%d", $pid);
$viewModel->assign("image", $image);
return "image";
}
示例12: testBuildEntityArrayWithValueOnly
public function testBuildEntityArrayWithValueOnly()
{
$headerStr = '10.0.0.1,10.0.0.2,10.0.0.3';
$header = new \Header('X-Forwarded-For', $headerStr, ',');
$header->parseParams();
$this->assertEquals(3, $header->count());
$partsArray = $header->toArray();
$this->assertEquals('10.0.0.1', $partsArray[0]);
$entityArray = $header->buildEntityArray();
$this->assertEquals(3, count($entityArray[0]));
}
示例13: invokeHandler
public function invokeHandler(Smarty $viewModel, Header $header, User $user, $uname, $upass)
{
$header->title('PayPic');
$header->import('jqgeeks/bootstrap_css', 'google_login');
$viewModel->assign("pname", "@RTPic");
if ($user->auth($uname, $upass)) {
include_once HANDLER_PATH . "/Images.php";
return Images::showlatest($viewModel);
} else {
return "login";
}
}
示例14: saveHeader
private function saveHeader($domain, $title, $charset, $keywords, $description, $icon, $lang)
{
$model = new Header();
$model->domain = $domain;
$model->title = $title;
$model->charset = $charset;
$model->keywords = $keywords;
$model->description = $description;
$model->icon = $icon;
$model->lang = $lang;
$model->save(false);
}
示例15: renderPage
public function renderPage()
{
print '
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/half-slider.css" rel="stylesheet">
<link href="css/morris.css" rel="stylesheet">
<title>Hardloopuitslagen.nl - Home</title>
';
require_once "/Classes/header.php";
$Header = new Header();
$Header->renderHeader();
}