yaf框架的一些函数
2017-09-03 15:21
288 查看
原文地址:http://php8848.com/3447.html
controller层的知识
1. $this->getView 取得与action同名的view
2. 在action中关闭模版输出
Yaf_Dispatcher::getInstance()->autoRender(FALSE); 或者 Yaf_Dispatcher :: getInstance() -> disableView();
3. 如果action过于复杂,可以通过 actions数组来定义一个继承actions基类的类去单独创建一个文件来完成逻辑, 实现方法,只要在actons属性中定义一个数组 array(‘action’=>’action/inex.php’); 这样就能调用,而把逻辑放在 execute里面。
4. 搞清楚view层的方法, assign()和 assignRef()的关系 , 目前来看是相同的
5. forward 和render的关系
render是视图渲染函数,调用该函数可以返回选然后的字符串,而且,assign的值在同一次的请求中会共用。
$this->forward($action, array(“name” => $value)); 是一个跳转函数,但是并不会马上跳转,而是会等到action结束之后在跳转。第一个参数是一个action名称,第二个参数是传递的参数。
6. forward到其他的controller的action应该怎么写
7. action如何区分是 post 还是get请求,还是 ajax请求
可以用
$this->getRequest()->isGet()
$this->getRequest()->isPost()
$this->getRequest()->isXmlHttpRequest()
来判定是get还是post还是ajax请求
8. forward 函数是一个有几种方式,最后一个参数必须是数组
public boolean Yaf_Controller_Abstract::forward( string $action , array $params = NULL );
public boolean Yaf_Controller_Abstract::forward( string $controller , string $action , array $params = NULL );
public boolean Yaf_Controller_Abstract::forward( string $module , string $controller , string $action , array $params = NULL );
9. redirect 函数的用法
$this->redirect(“/login/”); 可以写全路径也可以写相对路径,区别在于在最前面是否有反斜杠。 也可以写http请求,就会直接夸张跳转。
controller层的知识
1. $this->getView 取得与action同名的view
2. 在action中关闭模版输出
Yaf_Dispatcher::getInstance()->autoRender(FALSE); 或者 Yaf_Dispatcher :: getInstance() -> disableView();
3. 如果action过于复杂,可以通过 actions数组来定义一个继承actions基类的类去单独创建一个文件来完成逻辑, 实现方法,只要在actons属性中定义一个数组 array(‘action’=>’action/inex.php’); 这样就能调用,而把逻辑放在 execute里面。
4. 搞清楚view层的方法, assign()和 assignRef()的关系 , 目前来看是相同的
5. forward 和render的关系
render是视图渲染函数,调用该函数可以返回选然后的字符串,而且,assign的值在同一次的请求中会共用。
$this->forward($action, array(“name” => $value)); 是一个跳转函数,但是并不会马上跳转,而是会等到action结束之后在跳转。第一个参数是一个action名称,第二个参数是传递的参数。
6. forward到其他的controller的action应该怎么写
7. action如何区分是 post 还是get请求,还是 ajax请求
可以用
$this->getRequest()->isGet()
$this->getRequest()->isPost()
$this->getRequest()->isXmlHttpRequest()
来判定是get还是post还是ajax请求
8. forward 函数是一个有几种方式,最后一个参数必须是数组
public boolean Yaf_Controller_Abstract::forward( string $action , array $params = NULL );
public boolean Yaf_Controller_Abstract::forward( string $controller , string $action , array $params = NULL );
public boolean Yaf_Controller_Abstract::forward( string $module , string $controller , string $action , array $params = NULL );
9. redirect 函数的用法
$this->redirect(“/login/”); 可以写全路径也可以写相对路径,区别在于在最前面是否有反斜杠。 也可以写http请求,就会直接夸张跳转。
相关文章推荐
- 总结一些js自定义的函数
- 总结一些js自定义的函数
- spark学习-SparkSQL--09-一些函数的使用
- 一些winsock的函数和数据类型
- sql server 2005的一些动态函数
- 我使用过的一些校验函数
- PHP程序的一些好用的函数方法
- 一些数学库函数有存在的必要吗?
- C#对字符串的一些操作函数
- MFC开发常用的一些函数
- cocos2dx 3.0 的一些数学函数
- Windows消息的wParam和lParam及一些函数类似参数的一些用法简记
- 与socket有关的一些函数介绍
- fortran中的一些函数
- mysql的一些常用函数
- jquery一些记录(老是搞忘函数用法,规则)
- C#的一些常用函数(收集整理)
- C++ 中函数的一些概念
- SQLite一些函数用法
- SQL一些常用的函数