Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 21889 программистов и 987 роботов. Сейчас ищут 666 программистов ...
Приступая к работе

Yaf_Controller_Abstract::forward - foward to another action

Вернуться к: Yaf_Controller_Abstract

Yaf_Controller_Abstract::forward

(Yaf >=1.0.0)

Yaf_Controller_Abstract::forwardfoward to another action

Описание

public void Yaf_Controller_Abstract::forward ( string $action [, array $paramters ] )
public void Yaf_Controller_Abstract::forward ( string $controller , string $action [, array $paramters ] )
public void Yaf_Controller_Abstract::forward ( string $module , string $controller , string $action [, array $paramters ] )

forward current execution process to other action.

Замечание:

this method doesn't switch to the destination action immediately, it will take place after current flow finish.

Список параметров

module

destination module name, if NULL was given, then default module name is assumed

controller

destination controller name

action

destination action name

paramters

calling arguments

Примеры

Пример #1 Yaf_Controller_Abstract::forward()example

<?php
class IndexController extends Yaf_Controller_Abstract
{
    public function 
indexAction(){   
         
$logined $_SESSION["login"];
         if (!
$logined) {
             
$this->forward("login", array("from" => "Index")); // forward to login action
             
return FALSE;  // this is important, this finish current working flow
                            // and tell the Yaf do not doing auto-render
         
}

         
// other processes
    
}

    public function 
loginAction() {
         echo 
"login, redirected from "$this->_request->getParam("from") , " action";
    }
}
?>

Результатом выполнения данного примера будет что-то подобное:

   login, redirected from Index action

Возвращаемые значения

return FALSE on failure

Смотрите также

  • Yaf_Request_Abstrace::getParam()


Вернуться к: Yaf_Controller_Abstract

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware