1. First, download the ThinkPHP framework
ThinkPHP official website provides a complete framework download package, we need to go to the official website (http://www .thinkyisu.com/download.html) to download the latest version of the framework, and then extract it to the specified directory.
2. Download the template file
The template file is downloaded from the official website (https://github.com/krissss/thinkphp-template).
3. Unzip the template file to the specified directory
Unzip the downloaded template file, and place the decompressed template directory in the root directory of the ThinkPHP framework.
4. Configuration template file
Modify the configuration information in the Application/Conf/config.php file to match the template file we downloaded, as shown below Shown:
5. Using templates in the controller
The template files used in the controller need to be downloaded from the template folder under Application/View/ Call, for example:
$this->display('User/login');
Among them, User is the subdirectory under the corresponding controller; login is the specified template file name.
6. Application template
在视图文件中使用模板时,需要使其与控制器中相应的方法匹配。例如,若在User控制器中定义了login()方法,则在相应的视图文件(如User/login.html)中调用,如下图所示:
The above is the detailed content of What are the installation steps for ThinkPHP templates?. For more information, please follow other related articles on the PHP Chinese website!