0
如何檢查isAuthenticated
或isLogged
in symfony 1.4從外部的PHP文件?位於/web/js/filemanager.php
如何從外部PHP文件檢查symfony 1.4中的isAuthenticated?
如何檢查isAuthenticated
或isLogged
in symfony 1.4從外部的PHP文件?位於/web/js/filemanager.php
如何從外部PHP文件檢查symfony 1.4中的isAuthenticated?
的唯一方法
外部PHP文件傳遞isAuthenticated到另一外部php文件是通過sfUser類的一個對象
@應用程序/前端/模塊/ indexAction.class.php
<?php
class modulenameAction extends sfAction
{
public function execute($request)
{
$user = $this->getUser();
$sample = new Sample();
$sample
->setUser($user)
->setOtherFunction($blabla)
->setOtherFunction($blabla);
if ($sample->result()) {
return $this->renderText('Authenticated');
} else return $this->renderText('Not authenticated');
}
}
然後你的Sample類
<?php
class Sample
{
private $user;
public function setUser($user)
{
$this->user = $user;
return $this;
}
public function result()
{
if ($this->user->isAuthenticated())
{
return true;
}
return false;
}
}