2010-07-31 11 views

답변

0

때문에 :

<?php 
    class MyComponent extends Object { 
    // This component uses other components 
    var $components = array('Session', 'Math'); 
    function doStuff() { 
     $result = $this->Math->doComplexOperation(1, 2); 
     $this->Session->write('stuff', $result); 
    } 
    } 
?> 

당신은 샘플이 수행되는 곳부터 this을 확인해야합니다.

+0

플러그인에서 $ this-> Controller-> Session-read()를 수행하여 세션의 var에 액세스해야하는 것처럼 보입니다. – Owen

+0

사실,하지만 $ this-> Controller 인스턴스를 전달해야합니다. 즉, 플러그인을 호출 할 때 $ this-> PluginComponent-> method ($ this);를 전달해야합니다. 플러그인의 매개 변수로 올바르게 설정하십시오. 너무 많은 노력이 필요합니다. 그래서 나는 그것을 제안하지 않습니다. –

+0

@NikChankov 플러그인 파일에서 세션 값을 가져와서 어떻게해야합니까? – coder

관련 문제