php项目中商店mvc框架总结(1),mvc框架
php项目中商店mvc框架总结(1),mvc框架
1.代码结构的划分:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
2.请求首页
2.1请求首页参数实例(请求localhost/index.php?p=front&c=shop&a=index)
1 2 3 |
|
2.2 首页统一请求代码
1 2 3 4 5 |
|
2.3框架类代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
2.3.1初始化路径常量
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
2.3.2加载配置文件
1 2 3 4 |
|
2.3.3初始化分发参数
1 2 3 4 5 6 7 8 9 10 11 |
|
以上代码中用到了初始加载配置文件,初始化默认请求,当你直接请求:localhost/index.php,没有参数的时候,加载系统默认参数
2.3.4初始化平台相关的路径常量
1 2 3 4 5 6 7 8 9 |
|
2.3.4注册自动加载方法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
2.3.4 请求分发
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
2.3.5当我们请求localhost/index.php的时候,相当于请求localhost/index.php?p=front&c=shop&a=index于是将初始化
application\controller\front下的ShopController控制器,请求动作为indexAction
indexAction代码如下:
1 2 3 4 5 6 7 |
|
需要说明的是:
1、ShopController继承与平台控制器PlatformController,平台控制器继承于基础控制器类:controller
关系如下:
2、在确定好MVC中的,Control动作后,接下来就是实现Model
1 2 |
|
3、在基础模型中,封装好所有基础操作数据库方法,其中getNestedLIst方法如下
1 2 3 4 5 6 7 8 9 |
|

Heiße KI -Werkzeuge

Undresser.AI Undress
KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover
Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Undress AI Tool
Ausziehbilder kostenlos

Clothoff.io
KI-Kleiderentferner

AI Hentai Generator
Erstellen Sie kostenlos Ai Hentai.

Heißer Artikel

Heiße Werkzeuge

Notepad++7.3.1
Einfach zu bedienender und kostenloser Code-Editor

SublimeText3 chinesische Version
Chinesische Version, sehr einfach zu bedienen

Senden Sie Studio 13.0.1
Leistungsstarke integrierte PHP-Entwicklungsumgebung

Dreamweaver CS6
Visuelle Webentwicklungstools

SublimeText3 Mac-Version
Codebearbeitungssoftware auf Gottesniveau (SublimeText3)

Heiße Themen

PHP 8.4 Installations- und Upgrade-Anleitung für Ubuntu und Debian

So richten Sie Visual Studio-Code (VS-Code) für die PHP-Entwicklung ein
