本文整理匯總了PHP中Generic::init方法的典型用法代碼示例。如果您正苦於以下問題:PHP Generic::init方法的具體用法?PHP Generic::init怎麽用?PHP Generic::init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Generic
的用法示例。
在下文中一共展示了Generic::init方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: init
/**
* Constructor
* @return void
*/
public function init()
{
parent::init();
if ($this->isFinished()) {
return;
}
$this->out("\r\n", false);
}
示例2: init
/**
* Constructor
* @return void
*/
public function init()
{
parent::init();
$this->header('Cache-Control: max-age=31536000, public, pre-check=0, post-check=0');
$this->header('Expires: ' . date('r', strtotime('+1 year')));
echo "Welcome to SockJS!\n";
$this->finish();
}
示例3: init
/**
* Constructor
* @return void
*/
public function init()
{
parent::init();
if (isset($this->attrs->version)) {
$this->version = $this->attrs->version;
}
$this->header('Cache-Control: max-age=31536000, public, pre-check=0, post-check=0');
$this->header('Expires: ' . date('r', strtotime('+1 year')));
$html = '<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script>
document.domain = document.domain;
_sockjs_onload = function(){SockJS.bootstrap_iframe();};
</script>
<script src="https://cdn.jsdelivr.net/sockjs/' . htmlentities($this->version, ENT_QUOTES, 'UTF-8') . '/sockjs.min.js"></script>
</head>
<body>
<h2>Don\'t panic!</h2>
<p>This is a SockJS hidden iframe. It\'s used for cross domain magic.</p>
</body>
</html>';
$etag = 'W/"' . sha1($html) . '"';
$this->header('ETag: ' . $etag);
if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
if ($_SERVER['HTTP_IF_NONE_MATCH'] === $etag) {
$this->status(304);
$this->removeHeader('Content-Type');
$this->finish();
return;
}
}
$this->header('Content-Length: ' . mb_orig_strlen($html));
echo $html;
$this->finish();
}
示例4: init
/**
* Constructor
* @return void
*/
public function init()
{
parent::init();
if ($this->isFinished()) {
return;
}
echo str_repeat(' ', 1024);
echo "\n\n";
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
<h2>Don't panic!</h2>
<script>
document.domain = document.domain;
var c = parent.<?php
echo $_GET['c'];
?>
;
c.start();
function p(d) {
c.message(d);
}
;
window.onload = function () {
c.stop();
};
</script>
</body>
</html>
<?php
}