Heim  >  Artikel  >  Backend-Entwicklung  >  phpcas 登录跳转有关问题

phpcas 登录跳转有关问题

WBOY
WBOYOriginal
2016-06-13 13:08:201072Durchsuche

phpcas 登录跳转问题

//导入cas
require_once("CAS.php");

phpCAS::client(CAS_VERSION_2_0,'localhost',8443,'cas',true);
phpCAS::setNoCasServerValidation();

phpCAS::forceAuthentication();
if(phpCAS::isAuthenticated()==true){
	
	echo phpCAS::getUser();
	
	
}else{
          echo "abc";
}
?我现在在所有的php的所有的头里面加了这段代码。相当于是java里面的过滤器。?

现在问题出来了,我如果没有认证,访问php页面的时候会跳到cas登录页面,我现在的要求是:?
不管是否登录都能访问到php页面。1.如果已经登录,则显示用户名2.如果没有登录,则打印abc。?
上述代码只满足第一点,第二点不满足。请问这个应该怎么实现?

1 楼 cstarclear 2011-09-15  
phpCAS::forceAuthentication(); 

这句去掉就行了
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn