2013-07-23 3 views
0

내 문제는보기에서 submit 버튼을 누른 후 발생하기 때문에 매개 변수를 잃는 것입니다 (즉, id 변수를 사용할 수 없음). if 조건 안에 들어가면 (예 : 배열을 설정 한 후)템플릿 내용을 설정 한 후 매개 변수를 전달하는 방법은 무엇입니까?

public function action_resetpassword() 
{ 
    $this->template->content = View::factory('user/password/reset') 
    ->bind('message', $message) 
    ->bind('errors', $errors); 

    if (HTTP_Request::POST == $this->request->method()) 
    {   
     $id = $this->request->param('id'); 

답변

1

올바르게 이해하면 if에 설정된보기에 매개 변수를 전달하고 싶습니다. 이것은 $id 이제 요청 파라미터로부터 오는 어떤 값을 가질 것이다 (즉 기준 통과)

public function action_resetpassword() 
{ 
    $this->template->content = View::factory('user/password/reset') 
     ->bind('message', $message) 
     ->bind('errors', $errors) 
     ->bind('id', $id); // Empty variable is defined here ... 

    if (HTTP_Request::POST == $this->request->method()) 
    { 
     // ... and set here 
     $id = $this->request->param('id'); 

보기 내보기에 '바인딩'이 변수에 의해 쉽게 행해질 수있다.

이 당신이 무슨 뜻인지 아닌 경우,이 변수 PHP의 범위와이 문제에 대해 조금 읽어야 반드시

http://php.net/manual/en/language.variables.scope.php

Kohana

관련이 없습니다
관련 문제