PHP中的全局数组声明,CodeIgniter

时间:2016-08-23 09:52:23

标签: php arrays function codeigniter

我有一个codeigniter的情况。我在数组中声明所有CSS($ impcss)和JavaScript($ impjs)文件并在函数内调用它们:

public function index()
    {
        // Load css here
        $impcss = array("style.css","color.css","transitions.css","bootstrap.css","bootstrap-responsive.css","jquery.bxslider.css","owl.carousel.css","parallax.css");
        $data['impcss'] = $impcss;

        //Load js here
        $impjs = array("jquery-1.11.0.min.js","bootstrap.min.js","jquery.bxslider.min.js","owl.carousel.js","modernizr.js","skrollr.min.js","functions.js");
        $data['impjs'] = $impjs;



        $this->load->view('layout/metainfo',$data);
        $this->load->view('layout/header');
        $this->load->view('homeView');
        $this->load->view('layout/footer');
    }

我想在index()函数等许多其他函数中使用相同的文件,所以我想全局声明它们并在其他函数中调用它们。请帮帮我。

0 个答案:

没有答案