| 제목 | autoload로 interface정의해서 사용하기. | ||
|---|---|---|---|
| 글쓴이 | SADBLUE | 작성시각 | 2011/02/08 17:26:01 | 
|  | |||
| 별건 아니구요... autoload를 이용하면 됩니다. interface를 helper에 선언을 해 두시고 autoload파일에 helper에 로드 하도록 만듭니다. $autoload['helper'] = array("interface/testInterface"); 다른 helper에서 그냥 상속받아 쓰면 됩니다 -_-; 
/* testinterface_helper.php */
abstract class testInterface
{
	protected $m_oController = null;
	function __construct()
	{
		$this->m_oController = &get_instance();
	}
	abstract function run($pParam);
}
/* testclass_helper.php */
	class testClass extends testInterface
	{
		function __construct()
		{
			parent::__construct();
		}
		public function run($pParam)
		{
			print_r($this->m_oController);
			return "test";
		}
	}샘플 코드.
$this->load->helper("/testcode/testclass");
$o = new testClass();
$pParam = array("param1" => "param");
$o->run($pParam);
다들 알고 계셨던거라면....죄송하구요.~_~;도움이 되셨기를 바랍니다. | |||
| 다음글 | CI 2.0 업글 팁. (3) | ||
| 이전글 | sqlserver 2008 연결시 포트번호 처리... | ||
| 없음 |