关于thinkphp与cas整合问题

浏览:3319 发布日期:2014/12/31 分类:求助交流 关键字: thinkphp cas
本人将thinkphp 和cas 整合,如果是原生的php没有问题:
<?php

include_once('CAS.php');//
// phpCAS::setExtraCurlOption(CURLOPT_SSLVERSION,3);
phpCAS::setDebug();

phpCAS::client(CAS_VERSION_2_0,'cas域名',8443,'cas');
// no SSL validation for the CAS server
phpCAS::setNoCasServerValidation();
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// logout if desired
if (isset($_REQUEST['logout'])) {
phpCAS::logout();
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="images/style.css" rel="stylesheet" type="text/css" />
<title>会员的个人面板</title>
</head>

<body>
<div id="panel">
<h3>会员面板</h3>
<div>
<h4>欢迎 橘汁 的到来</h4>
<ul class="quicklink">
<li>
<a href='#' target="_blank">我的邮箱</a>
</li>
<li>
<a href="#" target="_blank">管理我的空间</a>
</li>
<li>
<a href="#" target="_blank">站点管理平台</a>
</li>
<li>
<a href="#">安全退出</a>
</li>
<li>
<a href="#" target="_blank">站点首页</a>
</li>
<li>
<a href="#" target="_blank">交流论坛</a>
</li>
</ul>
<h1>Successfull Authentication!</h1>
<p>
the user's login is <b><?php echo phpCAS::getUser(); ?></b>
.
</p>
<p>
phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>
</p>
<p>
<a href="?logout=">Logout</a>
</p>
</div>
<div class="panelbot">
All Rights Reserved: ©2008
<a href="http://www.ojpal.com">
<span>橘汁仙剑网</span>
</a>
</div>
</div>
</body>
</html>
但是放入到thinkphp里就有问题了
我是放在index.php文件里:
<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

if(version_compare(PHP_VERSION,'5.3.0','<')) die('require PHP > 5.3.0 !');

/**
* 系统调试设置
* 项目正式部署后请设置为false
*/
define('APP_DEBUG', true );

/**
* 应用目录设置
* 安全期间,建议安装调试完成后移动到非WEB目录
*/
define ( 'APP_PATH', './Application/' );

if(!is_file(APP_PATH . 'User/Conf/config.php')){
header('Location: ./install.php');
exit;
}

/**
* 缓存目录设置
* 此目录必须可写,建议移动到非WEB目录
*/
define ( 'RUNTIME_PATH', './Runtime/' );

include_once('CAS.php');//
// phpCAS::setExtraCurlOption(CURLOPT_SSLVERSION,3);
phpCAS::setDebug();

phpCAS::client(CAS_VERSION_2_0,'cas域名,8443,'cas');
// no SSL validation for the CAS server
phpCAS::setNoCasServerValidation();
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// logout if desired
if (isset($_REQUEST['logout'])) {
phpCAS::logout();
}


/**
* 引入核心入口
* ThinkPHP亦可移动到WEB以外的目录
*/
require './ThinkPHP/ThinkPHP.php';
最佳答案
评论( 相关
后面还有条评论,点击查看>>