|
发表于 2011-8-4 18:20:27
|
显示全部楼层
本帖最后由 jeongee 于 2011-8-4 18:20 编辑
kevin0171 发表于 2011-8-4 18:14
自定义函数我试过,是$this->db->checkme();么?
。。。。按照你1楼发的,你至少要有下面红色的部分吧,推荐学学PHP基础和OOP基础
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Member extends CI_Controller
{
function __construct()
{
parent::__construct();
}
function checkme($username,$password)
{
//你的验证代码
return 'yes';
}
function index()
{
$data['title'] = '登录成功';
$this->load->library('session');
$username=$this->session->userdata('username');
if($this->checkme($username,$password)=='yes')
{
$session=array
(
'status'=>'OK',
);
$this->session->set_userdata($session);
$this->mainpage();
}
echo "您的用户名是:".$username;
$this->load->view('success',$data);
}
}
?> |
|