search
HomePHP FrameworkThinkPHPLearning: ThinkPHP deployment directory

The following is an introduction to the ThinkPHP deployment directory from the thinkphp framework tutorial column. I hope it will be helpful to friends in need!

1. Problem: I was very confused about the directory structure when writing the project according to the deployment directory instructions in document 2.2.3
2. Solution: (Officially gives two deployment solutions)
1. Official recommendation Solution
Official recommended solution: (Table of contents as shown below)

#Operation Steps:

1.1 Download the ThinkPHP software package, create a new TESTAPP directory, and put the ThinkPHP folder into the TESTAPP folder.

1.2 If necessary Create the front-end directory Home and the back-end directory Admin, and create a new entry file index.php in the TESTAPP folder (used to create the Home directory). The code is as follows:

<?php

//1.确定前台文件夹名称 Home

define(&#39;APP_NAME&#39;,&#39;Home&#39;);

//2.确定应用路径

define(&#39;APP_PATH&#39;,&#39;./Home/&#39;);

//3.开启调试模式

define(&#39;APP_DEBUG&#39;,true);

//4.应用核心文件

require &#39;./ThinkPHP/ThinkPHP.php&#39;;

1.3 Create a new entry file admin.php in the TESTAPP folder (used to create the Admin directory). The code is as follows:

<?php

//1.确定后台文件名称 Admin

define(&#39;APP_NAME&#39;,&#39;Admin&#39;);

//2.确定应用路径

define(&#39;APP_PATH&#39;,&#39;./Admin/&#39;);

//3.开启调试模式,防止缓存造成调试问题

define(&#39;APP_DEBUG&#39;,true);

//4.应用核心文件

require &#39;./ThinkPHP/ThinkPHP.php&#39;;

1.4 After the two files are written, enter them in the browser. http://localhost/bbs/index.php automatically generates the Home folder, enter http://localhost/bbs/admin.php

When you see the Welcome to thinkPHP prompt, the directory structure is as shown in the figure:

Deployment Finish.

1.5 Start writing code

If you need a User controller, create a new UserAction.class in the Admin folder. php, write the following code:

##

<?php

class UserAction extends Action {
    public function index(){
    	        
        $this->user=M(&#39;user&#39;)->select();
  
        
        $this->display();    
    }
}

Create a new folder Home in tpl, create a new File index.html, write the following code:

##

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <!-- 引入 jquery 和 layer 插件 -->
     <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
     <script src="http://apps.bdimg.com/libs/layer/2.1/layer.js"></script>
</head>
<body>
        <a href="__URL__/add">添加</a>
    <table>
    <volist id="vo" name="user">
        
            <tr>
                <td>{$vo.username}</td>
                <td><a href="{:U(&#39;Index/edit&#39;,array(&#39;id&#39;=>$vo[&#39;id&#39;]))}">修 改</a></td>
            </tr>
        
    </volist>
    </table> 

</body>
</html>
Configure database information in config.php in Conf in the Admin folder

Enter the URL http://localhost/TESTAPP/admin.php/User/index, you can see the results

2. Group module solution (will be added after testing)

The above is the detailed content of Learning: ThinkPHP deployment directory. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:csdn. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version