用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1333|回复: 3
收起左侧

[HELP] CI类中的变量

[复制链接]
发表于 2014-4-17 23:44:15 | 显示全部楼层 |阅读模式
PHP复制代码
class blog extends CI_Controller {
    public $bianliang = '';
    function __consturct()
    {
        parent::__construct();
        $this->bianliang = 'alsdkjf';
    }
 
    public function index()
    {
        //$this->load->library('pagination');
 
        //$config['base_url'] = 'http://www.egirlasm.com/index.php/blog/page/';
        //$config['total_rows'] = '200';
        //$config['per_page'] = '20';
 
        //$this->pagination->initialize($config);
 
        //echo $this->pagination->create_links();
        echo "1";
        echo $this->bianliang;
复制代码


只有输出 1 没有输出 上面的 百思不得其解,求高手解答。

发表于 2014-4-18 08:21:47 | 显示全部楼层
构造函数加public

评分

参与人数 1威望 +5 收起 理由
egirlasm + 5 很给力!

查看全部评分

发表于 2014-4-18 17:26:12 | 显示全部楼层
粗心....构造函数名字写错l了,function __consturct()-------------------应该是 function __construct()

评分

参与人数 1威望 +5 收起 理由
egirlasm + 5 很给力!

查看全部评分

 楼主| 发表于 2014-4-20 04:18:09 | 显示全部楼层
谢谢大家 这个好像不是我手写的 复制的啊

本版积分规则