MVC模式和URL访问
来源:互联网 发布:淘宝网大衣外套 编辑:程序博客网 时间:2024/06/11 13:10
一、什么是MVC //了解M -Model 编写model类 对数据进行操作 使用Model类 来操作数据V -View 编写html文件,页面呈现C -Controller 编写类文件(UserAction.class.php)二、ThinkPHP的MVC特点 //了解三、ThinkPHP的MVC对应的目录 //了解M 项目目录/应用目录/Lib/ModelC:\wamp\www\thinkphp\Home\Lib\ModelV 项目目录/应用目录/TplC:\wamp\www\thinkphp\Home\TplC 项目目录/应用目录/Lib/ActionC:\wamp\www\thinkphp\Home\Lib\Action四、url访问C //了解五、url的4种访问方式 //重点!1.PATHINFO 模式 -- 重点!!!!!!http://域名/项目名/入口文件/模块名/方法名/键1/值1/键2/值2http://localhost/thinkphp/index.php/Index/show2.普通模式http://域名/项目名/入口文件?m=模块名&a=方法名&键1=值1&键2=值23.REWRITE模式http://域名/项目名/模块名/方法名/键1/值1/键2/值24.兼容模式http://域名/项目名/入口文件?s=模块名/方法名/键1/值1/键2/值2http://localhost/thinkphp/ 访问的是index.php 主入口文件http://localhost/thinkphp/index.php/Index/index 模块/方法C:\wamp\www\thinkphp\Home\Lib\Action 默认模块IndexAction.class.php比如要创建用户模块UserAction.class.phpclass IndexAction extends Action 继承Action类<?php// 本类由系统自动生成,仅供测试用途class IndexAction extends Action { public function index(){$this->show('hello-world'); }}http://localhost/thinkphp/index.php/Index/show访问Index 模块的show方法<?php// 本类由系统自动生成,仅供测试用途class IndexAction extends Action { public function index(){$this->show('hello-world'); } public function show(){echo 访问了Index模块的show方法; }}接口传参:<?php// 本类由系统自动生成,仅供测试用途class IndexAction extends Action { public function index(){$this->show('hello-world'); } public function show(){ echo 访问了Index模块的show方法; echo "欢迎你".$_GET['name']"; }}http://localhost/thinkphp/index.php/Index/show?name=jjhttp://localhost/thinkphp/index.php/Index/show/name/jjhttp://localhost/thinkphp/index.php/Index/show/name/xxyyzz传递多个参数:<?php// 本类由系统自动生成,仅供测试用途class IndexAction extends Action { public function index(){$this->show('hello-world'); } public function show(){ echo 访问了Index模块的show方法; echo "欢迎你".$_GET['name'].'你的年龄是'.$_GET['age']; }}http://localhost/thinkphp/index.php/Index/show/name/xxyyzz/age/22
0 0
- MVC模式和URL访问
- MVC模式和URL访问
- MVC模式和URL访问
- thinkPHP02 .... MVC模式和URL访问
- 3.1.2 MVC模式和URL访问
- ThinkPHP的MVC模式和URL访问
- ThinkPHP MVC模式、URL访问控制器和调试模式
- ThinkPHP学习笔记(二)MVC模式和URL访问
- ThinkPHP学习笔记(2)--MVC模式和URL访问
- ThinkPHP 学习笔记 2.MVC模式和URL访问
- ThinkPHP(2)--MVC模式和URL访问
- ThinkPHP 3.1.2 介绍及安装 MVC模式和URL访问
- ThinkPHP第二课 框架MVC目录和URL访问方式
- ThinkPHP URL访问模式
- ThinkPHP的URL访问模式
- spring mvc url匹配禁用后缀访问
- ThinkPHP中pathinfo的两种模式、四种路径访问模式和URL重写
- ThinkPHP中pathinfo的两种模式、四种路径访问模式和URL重写
- request.getParameterMap()
- STL与泛型编程<十五>:预定义的仿函数和仿函数适配器
- 正则表达式 Regular Expression
- C++程序形成过程
- unity official Networking tutorial总结
- MVC模式和URL访问
- sublime_text中如何使用快捷键打开默认浏览器
- 关于基本控件Spinner属性大全详解
- android学习总结(1)
- [练习4]js学习之图片的水平滚动
- 贪心算法总结
- qt截获html请求
- ZJNU1804SONG F(multiset)
- 添加自定义事件以及对osg事件队列的简单理解