Home  >  Article  >  Backend Development  >  phpcas 登录跳转有关问题

phpcas 登录跳转有关问题

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

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(); 

这句去掉就行了
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn