| 제목 | CLE 의 MY_PageController 의 의문점 | ||
|---|---|---|---|
| 글쓴이 | 터프키드 | 작성시각 | 2009/11/23 17:54:22 | 
|  | |||
| 전에는 CLE 의 세개 파일 pagecontroller, loader, controller 를 그대로 넣고 잘 썼는데요 1.7.2 버전의 문제인지 이번에는 아래와 같은 에러를 뿜어내네요;; A PHP Error was encounteredSeverity: Warning Message: The magic method __get() must have public visibility and cannot be static Filename: libraries/MY_PageController.php Line Number: 8 A PHP Error was encounteredSeverity: Warning Message: The magic method __call() must have public visibility and cannot be static Filename: libraries/MY_PageController.php Line Number: 14 
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_PageController extends MY_Controller {
  function __construct()
	{
		parent::getInstance();	
	}
	  
  protected function __get($var){
    if(isset(parent::$instance->$var)) {
      return parent::$instance->$var;
    }
  }
  protected function __call($name, $arguments) {  
    if(method_exists(parent::$instance,$name))
    call_user_func_array(array(parent::$instance, $name), $arguments);
  }
}
/* End of file MY_PageController.php */
/* Location: ./system/application/libraries/MY_PageController.php */__get 이나 __set , __call() 등의 메소드는 기본적으로 public 으로 선언되어야 하는데 protected로 선언되어있네요 근데 왜 1.7.1 에서는 정상적으로 돌아갔을까요? public 으로 고쳐서 정상적으로 작동은 하는데 궁금하네요; | |||
| 다음글 | [초보질문]mysql_real_escape_string... (3) | ||
| 이전글 | [초보질문] BR 테그에 관하여~ (2) | ||
| 
                                byung82
                                /
                                2009/11/23 17:58:51 /
                                추천
                                0
                             | 
| 
                                ci세상
                                /
                                2009/11/23 23:12:05 /
                                추천
                                0
                             php 버젼이 바뀌신것 같은데요.. php 5.3에서는 위와 같은 문법은 오류가 납니다. | 
오류내용도 보면
The magic method __get() must have public visibility and cannot be static
magic 함수는 꼭 필히 public으로 해달라고 말이 있으니 ㅎㅎ 그렇게 고쳐주시는게 맞는거 입니다.
그럼