我的Phalcon应用程序有一个布局,在主布局的div元素中有另一个布局。我的问题是,当会话时间结束时,登录表单(会话/索引)出现在第二个布局中。下面是一个可视的代码,用于检查会话是否仍处于活动状态。我知道发生了什么。只是找不到一个预置我想要的行动的解决方案。谢谢。
<?php
use Phalcon\Mvc\Controller;
use Phalcon\Mvc\Dispatcher;
class ControllerBase extends Controller
{
protected function initialize()
{
$this->tag->setTitle('Website | ' . $this->view->H1Tag);
$this->flash->output();
}
public function beforeExecuteRoute(Dispatcher $dispatcher)
{
if (!$this->session->has('auth') && $dispatcher->getControllerName() != 'session') {
$dispatcher->forward(['controller' => 'session', 'action' => 'index']);
return false;
}
}
}
发布于 2018-10-13 07:04:04
您可能必须在脚本中注入JS :在重定向到登录页面之前,如下所示:
<?php echo "<script>window.top.location.href = \"http://www.yourdomain/login\";</script>"; ?>
作为一种服务器端语言,PHP本身无法摆脱iframe。
https://stackoverflow.com/questions/52783536
复制相似问题