本文整理汇总了PHP中Nette\Http\Session::close方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::close方法的具体用法?PHP Session::close怎么用?PHP Session::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Http\Session
的用法示例。
在下文中一共展示了Session::close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionImage
public function actionImage()
{
if (substr($this->url, 0, 7) === self::DIRECTORY_CACHE . '/') {
$this->cached = true;
$this->url = substr($this->url, 7);
}
if (($entity = $this->fileRepository->findOneBy(array('path' => $this->url))) === null) {
throw new \Nette\Application\BadRequestException(sprintf('File \'%s\' does not exist.', $this->url));
}
$image = Image::fromFile($entity->getFilePath());
$this->session->close();
// resize
if ($this->size && $this->size !== 'default') {
if (strpos($this->size, 'x') !== false) {
$format = explode('x', $this->size);
$width = $format[0] !== '?' ? $format[0] : null;
$height = $format[1] !== '?' ? $format[1] : null;
$image->resize($width, $height, $this->format !== 'default' ? $this->format : Image::FIT);
}
}
if (!$this->type) {
$this->type = substr($entity->getName(), strrpos($entity->getName(), '.'));
}
$type = $this->type === 'jpg' ? Image::JPEG : $this->type === 'gif' ? Image::GIF : Image::PNG;
$file = sprintf('%s/%s/%s/%s/%s/%s', $this->cacheDir, self::DIRECTORY_CACHE, $this->size, $this->format, $this->type, $entity->getPath());
$dir = dirname($file);
umask(00);
@mkdir($dir, 0777, true);
$image->save($file, 90, $type);
$image->send($type, 90);
}
示例2: handleCheck
/**
* @param int $id
*/
public function handleCheck($id)
{
$this->session->close();
$this->redrawControl('check');
$this->template->last = $newerThan = $this->commentDao->find($id);
for ($x = 0; $x < 100; $x++) {
if ($this->countNewComments($newerThan)) {
$this->template->new = $this->getNewComments($newerThan);
$this->template->last = end($this->template->new);
$this->redrawControl('new');
break;
}
sleep(1);
}
}