本文介绍了控制器Codeigniter(父母)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!我在文件夹applications / core创建了自己的类,并将其命名为MY_Output.php

Hello! I created my own class at folder applications/core and named it MY_Output.php

class MY_Output extends CI_Output {

    function set_status_header($code = 200, $text = '')
    {
        set_status_header($code, $text);
        $this->last_set_status_code = $code;
        return $this;
    }

    function get_status_header()
    {
        return $this->last_set_status_code;
    }

}







At folder controllers i created new controller Error.php:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Error extends MY_Output
{
	public function __construct()
	{
		parent::__construct();
	}

	function error_404()
	{

			$this->load->view('404');
	}
}

?>  





如何从类Error中访问(调用)类MY_Output的函数?



How i can get access (call) to functions of class MY_Output from class Error?

推荐答案




这篇关于控制器Codeigniter(父母)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-19 13:41