Start your MVC (1) to integrate your site entry with PHP

zhaozj2021-02-12  222

This is a file that describes how to use PHP to implement MVC mode development. About the technical article on the MVC mode can be located everywhere, so this document will no longer tell the advantages and disadvantages of this model (actually I can't say it), and the child speaks his PHP technology. And in the next series of articles is also based on techniques. First, realize a unified website entry (the method of calling the Controler layer in the MVC, that is, the control layer) You may often see this path on the Internet (http://www.aaa.com/aaa/bbb/aaa?id = 5), make people understand that there are several possibilities: 1. Hidden file extensions, the benefits of this practice, the people's speech, but individual feels no need; 2, use the website Redirect rules, implement virtual paths; 3. Forced file parsing, virtual paths. Use the second third method to realize the unified interface of the website, a reasonable integrated website, better refer to the security and architecture of the website, most of the two ways of the website is built and implemented using the "MVC" mode. Here is an example access path as follows:

... / TEST / ******* / BAD ... / TEST / ******* / Good ("******" can be used Character string replace, "......." is your web path)

The directory structure of the file is as follows

| - .htaccess | - TEST | - Application.php | - Controler / GoodControl.php | - Controler / BadControl.php Note File ".htaccess", can not be created directly under Windows, can be on the command line Built in mode.

File 0 :(. Htaccess) (this file is used to change the Apache configuration method)

forceType Application / X-httpd-php

Document 1: (Test.php)

parse (); $ aa-> go ();?>>

File 2: (GoodControlr.php)

File 3: (BadControlr.php)

File 4: (Application.php)

转载请注明原文地址:https://www.9cbs.com/read-6133.html

New Post(0)