egirlasm 发表于 2014-4-17 23:44:15

CI类中的变量

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

neovenpo 发表于 2014-4-18 17:26:12

粗心....构造函数名字写错l了,function __consturct()-------------------应该是 function __construct()

egirlasm 发表于 2014-4-20 04:18:09

谢谢大家 这个好像不是我手写的 复制的啊
页: [1]
查看完整版本: CI类中的变量