Hit Counter in Codeigniter

荒凉一梦 提交于 2019-12-01 00:51:21

I got it to work fine when I loaded the helper $this->load->helper('counter');

application > core > MY_Controller.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Controller extends CI_Controller
{
    public $count_visitor;

    public function __construct()
    {
        parent::__construct();
        $this->load->helper('counter');
        $this->count_visitor = count_visitor();
    }   
}
Palash Ghatak

Yes, must load the helper:

$this->load->helper('counter');

or

config/autoload.php: $autoload['helper'] = array('counter');

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!