6. Controller
来源:互联网 发布:球球大作战刷圣衣软件 编辑:程序博客网 时间:2024/05/16 05:08
1.Controller
Request :
$a = $this->getRequest()->get('a');
Response :
return new RedirectResponse('http://www.baidu.com'); // 重定向 return new Response('hello,world'); // 直接返回正文,不结果模板渲染 return new JsonResponse(array("a"=>4)); // 返回 json 数据
Session :
$a = $this->getRequest()->getSession()->set('c',100); //设置 session $a = $this->getRequest()->getSession()->get('c'); // 获取 session $this->getRequest()->getSession()->getFlashBag()->add('notice','you have something wrong'); //用于只显示一次的信息,后面可以用循环取出
Service :
$doctrine = $this->get('doctrine'); // 获取一个服务,数据库服务
小结:
可以建 一个 BaseController
0 0
- 6. Controller
- controller
- Controller
- controller
- @controller
- Controller
- controller
- controller
- @Controller
- controller
- Controller
- Controller
- controller
- Controller
- controller跳转controller
- Installing Ubiquiti Unifi Controller on CentOS 6.x
- Struts Controller
- 创建 Controller
- Eclipse中好用的Properties Editor插件(属性文件编辑器)
- Windows下Pytesser安装
- 欢迎使用CSDN-markdown编辑器
- SSDsim源码分析之make_aged
- ==和equals究竟有什么区别
- 6. Controller
- Java + 面向抽象abstract类与函数实现(计算三角形、圆形的面积)
- 快速排序 java实现
- 134. PHP 工具
- R语言抓取暴风魔镜评论数据并绘制各省市购买量热力图
- 声明两个变量:int n1=10,n2=20;要求将两个变量交换,最后输出n1为20,n2为10。扩展(*):不使用第三个变量如何交换?
- LCD12864的详解
- 1390 Prepared statement contains too many placeholders
- iOS直播APP-点赞动画的实现