如何从外部PHP文件检查symfony 1.4中的身份验证?
如何从外部PHP文件检查如何从外部PHP文件检查symfony 1.4中的身份验证?,php,session,symfony1,symfony-1.4,Php,Session,Symfony1,Symfony 1.4,如何从外部PHP文件检查symfony 1.4中的isAuthenticated或isLogged 位于/web/js/filemanager.PHP中的外部PHP文件将isAuthenticated传递给另一个外部PHP文件的唯一方法是传递sfUser类的对象 @app/frontend/module/indexAction.class.php <?php class modulenameAction extends sfAction { public function execu
symfony 1.4中的isAuthenticated
或isLogged
位于/web/js/filemanager.PHP
中的外部PHP文件将isAuthenticated传递给另一个外部PHP文件的唯一方法是传递sfUser类的对象
@app/frontend/module/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');
}
}
<?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;
}
}