我是CodeIgniter框架的新手。我已經使用OpenID對於試圖登錄我複製lightopenid網址,並把它在配置/ config.php文件CodeIgniter使用google openid登錄
$config['base_url'] = 'https://gitorious.org/lightopenid/lightopenid/raw/9d42dc24e4dd34121c98a6491bc3ef7933a68a19:openid.php';
A PHP Error was encountered
Severity: Warning
Message: require(openid.php): failed to open stream: No such file or directory
Filename: models/login_model.php
Line Number: 2
請找我使用
控制器下面的代碼/ loginGoogle.php
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class LoginGoogle extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('login_model');
}
public function index()
{
require_once 'openid.php';
$openid = new LightOpenID("localhost");
$openid->identity = 'https://www.google.com/accounts/o8/id';
$openid->required = array(
'namePerson/first',
'namePerson/last',
'contact/email',
'birthDate',
'person/gender',
'contact/postalCode/home',
'contact/country/home',
'pref/language',
'pref/timezone',
);
$openid->returnUrl = 'http://localhost/login_thirdparty/codeigniterlogin/index.php/logingoogle/loginAuth';
$data['openid'] = $openid;
$this->load->view('googleLoginView', $data);
}
public function loginAuth()
{
$this->login_model->index();
}
}
型號/ login_model.php
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
require 'openid.php';
class Login_model extends CI_Model
{
public function index()
{
$openid = new LightOpenID("localhost");
if($openid->mode)
{
if($openid->mode == 'cancel')
{
echo "User has canceled authentication !";
}
elseif($openid->validate())
{
$data = $openid->getAttributes();
$email = $data['contact/email'];
$first = $data['namePerson/first'];
echo "Identity : $openid->identity <br />";
echo "Email : $email <br />";
echo "First name : $first";
echo "<pre>"; print_r($data); echo "</pre>";
}
else
{
echo "The user has not logged in";
}
}
else
{
echo "Go to the login page to logged in";
}
}
}
的意見/ googleLoginView.php
<html lang="en">
<head>
<title>Login using google account</title>
</head>
<body>
<a href = "<?php echo $openid->authUrl(); ?>" > Loging Using google account </a>
</body>
</html>
great.thank你。 – user3423301 2014-11-08 05:44:21
歡迎繼續。 – VenushkaT 2014-11-08 05:48:53