区分render _forward , _redirect
render:只能跳转到当前控制器模块下的页面,不指定render的时候,指定的是当前控制器下对应的函数名文件。 render('ok') 表示当前模块中的ok.phtml 这个文件。
_forward:可以跳转到其它控制器的页面(不能跳到其它网站), 比如 $this->_forward('err'); 这样就类似于 ...controller/err $this->_forward('err','global'); 就是GlobalController/err
_redirect:可以跳转到外网 $this->_reditect('/haha'); 跳转到haha 这个控制器 $this->_redirect('haha/test');跳转到haha 这个控制器的 test 方法 $this->_redirect('https://www.baidu.com'); 跳转到外网
1: 决定路径:速度相对会比较快一些(引用一些类文件) 2: 一些资源文件应该放在public这个文件夹中(如:css js image) |
|
来自: 人生大义 > 《zendframework》