Home >Backend Development >PHP Problem >Steps to build a website in php

Steps to build a website in php

藏色散人
藏色散人Original
2019-11-01 09:58:456831browse

Steps to build a website in php

php steps to build a website

php framework website building tutorial

First go to the official website to download the thinkphp3.2.3 version of the framework, or you can git the latest 3.2.3 function

Steps to build a website in php

Set the bound module in the index.php entry file define('BIND_MODULE','Project');, the bound module can be defined by yourself, set the application path define('APP_PATH','./myweb/');

Steps to build a website in php

##Open the convention.php convention file under ThinkPHP\Conf to set the database connection and other default framework related settings, including database settings, data cache settings, log settings, default settings, template engine settings, layout settings, URL Settings, router settings, etc.

Steps to build a website in php

Add a static page of index.html under the folder myweb\Project\View\Index as the output template

<div class="showtext tit">
<ul>
<li>用户名</li>
<li>密码</li>
<li>姓名</li>
<li>手机号</li>
<li>email</li>
</ul>
</div>
<div class="showtext">
<ul>
<foreach name="list" item="item" key="ix" >
<li>{$item["user_name"]}</li>
<li>{$item["password"]}</li>
<li>{$item["real_name"]}</li>
<li>{$item["phone_num"]}</li>
<li>{$item["email"]}</li>
</foreach>
</ul>
</div>

Add some simple data tests

Steps to build a website in php

Create a controller in myweb\Project\Controller to call, calculate, display and distribute the entire program, and pass the data through $ This->assign is used to assign values ​​to the template, and $this->display() is used to render the template and output the data.

Steps to build a website in php

It can be found under myweb\Project\Model Establish a data model and interact with the table through the D method or the m method. The memberModel.class.php file before the Model represents the name of the table member

Steps to build a website in php

Steps to build a website in php

Notes

You can also call the output directly without the model

display needs to be called after assign

For more PHP related knowledge, please visit

PHP中文网!

The above is the detailed content of Steps to build a website in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn