The Yaf_Controller_Abstract class

(Yaf >=1.0.0)

锟斤拷锟�

Yaf_Controller_Abstract 锟斤拷Yaf锟斤拷MVC锟斤拷系锟侥猴拷锟侥诧拷锟街★拷 MVC锟斤拷指Model-View-Controller, 锟斤拷一锟斤拷锟斤拷锟节凤拷锟斤拷应锟斤拷锟竭硷拷锟酵憋拷锟斤拷锟竭硷拷锟斤拷锟斤拷锟侥J斤拷锟�

每锟斤拷锟矫伙拷锟皆讹拷锟斤拷controller锟斤拷应锟斤拷锟教筹拷Yaf_Controller_Abstract锟斤拷

锟斤拷岱拷锟斤拷锟斤拷锟斤拷约锟斤拷锟絚ontroller锟斤拷锟睫凤拷锟斤拷锟斤拷__construct锟斤拷锟斤拷锟斤拷锟斤拷耍锟�Yaf_Controller_Abstract 锟结供锟斤拷一锟斤拷魔锟斤拷锟斤拷锟斤拷Yaf_Controller_Abstract::init()锟斤拷

锟斤拷锟斤拷锟斤拷锟斤拷约锟斤拷锟絚ontroller锟斤拷锟斤拷锟窖撅拷锟斤拷锟斤拷锟斤拷一锟斤拷init()锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟絚ontroller锟斤拷实锟斤拷锟斤拷锟斤拷时锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟矫★拷

Action锟斤拷锟斤拷锟斤拷要锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷时锟斤拷锟斤拷路锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥诧拷锟斤拷锟斤拷锟斤拷同锟斤拷锟狡的憋拷锟斤拷锟斤拷锟斤拷锟界:Yaf_Request_Abstract::getParam()锟斤拷锟斤拷 Yaf锟斤拷锟斤拷锟斤拷锟角达拷锟捷革拷action锟斤拷锟斤拷锟斤拷see Yaf_Action_Abstract::execute()锟斤拷锟斤拷

锟斤拷摘要

abstract Yaf_Controller_Abstract {
/* 锟斤拷锟斤拷 */
public $actions ;
protected $_module ;
protected $_name ;
protected $_request ;
protected $_response ;
protected $_invoke_args ;
protected $_view ;
/* 锟斤拷锟斤拷 */
final private __clone ( void ) : void
final private __construct ( void )
protected display ( string $tpl [, array $parameters ] ) : bool
public forward ( string $module [, string $controller [, string $action [, array $paramters ]]] ) : void
public getInvokeArg ( string $name ) : void
public getInvokeArgs ( void ) : void
public getModuleName ( void ) : string
public getRequest ( void ) : Yaf_Request_Abstract
public getView ( void ) : Yaf_View_Interface
public getViewpath ( void ) : void
public init ( void ) : void
public initView ([ array $options ] ) : void
public redirect ( string $url ) : void
protected render ( string $tpl [, array $parameters ] ) : string
public setViewpath ( string $view_directory ) : void
}

锟斤拷锟斤拷

actions

锟斤拷也锟斤拷锟斤拷通锟斤拷使锟斤拷锟斤拷锟街碉拷锟� Yaf_Action_Abstract 锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷PHP锟脚憋拷锟叫讹拷锟斤拷action锟斤拷锟斤拷锟斤拷

Example #1 锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷锟侥硷拷锟叫讹拷锟斤拷action

<?php
class IndexController extends Yaf_Controller_Abstract {
    protected 
$actions = array(
        
/** now dummyAction is defined in a separate file */
        
"dummy" => "actions/Dummy_action.php",
    );

    
/* action method may have arguments */
    
public indexAction($name$id) {
       
assert($name == $this->getRequest()->getParam("name"));
       
assert($id   == $this->_request->getParam("id"));
    }
}
?>

Example #2 Dummy_action.php

<?php
class DummyAction extends Yaf_Action_Abstract {
    
/* a action class shall define this method  as the entry point */
    
public execute() {
    }
}
?>

_module

模锟斤拷锟斤拷

_name

_request

锟斤拷前锟斤拷锟斤拷锟斤拷实锟斤拷

_response

_invoke_args

_view

锟斤拷图锟斤拷锟斤拷

Table of Contents