![Steps to build a website in php](https://img.php.cn/upload/article/000/000/020/5dbb913cad37b177.jpg)
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
![1572573291241945.png Steps to build a website in php](https://img.php.cn/upload/image/366/226/334/1572573291241945.png)
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/');
![1572573296429792.png Steps to build a website in php](https://img.php.cn/upload/image/860/515/633/1572573296429792.png)
##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.
![1572573300439765.png Steps to build a website in php](https://img.php.cn/upload/image/421/308/488/1572573300439765.png)
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>
Copy after login
Add some simple data tests
![1572573307647697.png Steps to build a website in php](https://img.php.cn/upload/image/370/238/495/1572573307647697.png)
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.
![1572573313381371.png Steps to build a website in php](https://img.php.cn/upload/image/986/321/609/1572573313381371.png)
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
![1572573321385708.png Steps to build a website in php](https://img.php.cn/upload/image/866/325/417/1572573321385708.png)
![1572573326367097.png Steps to build a website in php](https://img.php.cn/upload/image/373/762/917/1572573326367097.png)
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!