如何在Zend Framework中调用控制器函数?

use*_*968 1 php zend-framework controller function

在Zend Framework中,我有一个控制器

class TestController extends Zend_Controller_Action
{

    public function indexAction()
    {

    }

    public function getResultByID( $id )
    {
        return $id;
    }

}
Run Code Online (Sandbox Code Playgroud)

如何在index.phtml中调用函数getResultByID?

Vya*_*huk 5

第一:

public function indexAction()
{
  $this->view->controller = $this
}
Run Code Online (Sandbox Code Playgroud)

在您的视图脚本中:

<html><title><?php echo $this->controller->getResultByID($this->id); ?></title></html>
Run Code Online (Sandbox Code Playgroud)