Summary of "PHP Chinese Network Teaching Management System"

"PHP Chinese Network Teaching Management System" is a tiny project developed based on the Thinkphp5 framework. The front desk uses the H-ui template. I learned it by referring to the teaching video of Mr. Peter_zhu of the PHP Chinese website. I would like to thank Mr. Zhu.

Step 1: Set up a development environment

Development environment: environment built by PhpStudy (php must be above 5.4)

1. Go to www.thinkphp.cn to download the required framework files


2. Unzip the downloaded file to the root directory of the website, and change the folder name to edu

3. For convenience, set the local domain name,

Click "Other Options Menu"-----""Site Domain Name Management"-----""Add", (the entry file of thinkphp5 is in the public directory, so the website directory is filled in the public directory, mine is C:\phpStudy\WWW\edu\public) After filling in, click "Save Settings and Generate Configuration File"

3. Test

Open the browser and enter www.edu.com in the browser address bar, the result is as shown in the figure, indicating that the construction is successful

Step 2: Template introduction and inheritance

1. Baidu search H-ui, and then download the front-end template file

2. Load the css file of the template. Copy the lib and static folders in the template to the static directory under public in the framework directory

3. Set the MVC pattern of the framework. Create a new model directory and a view directory under the directory edu/application/index, because there is already a controller directory, the relationship between them is one-to-one correspondence

4. Render the template. Render with $this->view->fetch(); in the index.php file in the controller directory

5. View import. Put the index.html of the foreground file into the new view directory view (replace static/ in the file with __static__/static, several constants are defined in the original view class view in the framework, and what is loaded after replacement is the one in the template css and js files)

6. Separate templates. Since the various places in the file are clearly marked, it is straightforward to classify. Create several html pages in a new public directory under the view directory.

meta.html (meta information of related pages), header.html (mainly the header information of the file), menu, html (mainly the directory information of the file), footer.html (the script information of the file including the js file), and then Create a new parent template of Base.html, use {include name="public/file name.html"} to import the template file, and use {block name="module name"}{/block} to set the module to facilitate other sub-templates in the future Additional information defined in the module

*****Remember that the base template will only use the {include} and {block} tags, the others will hardly be used***********

7. Inherit the template. Use the {extend name="parent template.html" /} tag in the index.html file in the view folder to inherit, and then use the {block} tag to redefine it in the child template

8. This step can be omitted, but in order to improve efficiency, it is recommended to use {load herf="css or js file name" /} for unified import

Step 3: Administrator login and verification

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325852796&siteId=291194637