Home >PHP Framework >ThinkPHP >thinkphp build environment
ThinkPHP is an open source MVC framework. It uses PHP language as the basis for development and object-oriented programming as the guiding ideology, making Web application development simpler and more efficient. As it continues to develop and improve, more and more developers are starting to use ThinkPHP to build their own web applications.
This article will introduce how to use XAMPP to build a ThinkPHP development environment in a Windows environment.
Step one: Download and install XAMPP
First you need to download the latest version of XAMPP from the official website (https://www.apachefriends.org/zh_cn/index.html), and follow Prompt to install.
It should be noted during the installation process that you need to choose to install the two components PHP and MySQL and configure them as services so that they can be used in the command line.
Step 2: Download and decompress ThinkPHP
Download the latest version of ThinkPHP from the official website (http://www.thinkphp build environment.cn/) and decompress it to the XAMPP installation directory htdocs directory, as shown in the figure:
Step 3: Configure Virtual Hosts
There is an apacheconfextrahttpd-vhosts.conf in the XAMPP installation directory file, open the file with a text editor and configure it as follows:
<VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/thinkphp build environment/public" ServerName thinkphp build environment.test <Directory "C:/xampp/htdocs/thinkphp build environment/public"> Options FollowSymLinks Indexes AllowOverride All Require all granted </Directory> </VirtualHost>
The above configuration configures our ThinkPHP project as a Virtual Hosts, which specifies the root directory and domain name of the website (thinkphp build environment.test) , and set the rewrite rules of .htaccess.
Finally add a record in the Windows hosts file to resolve the domain name to the local IP address:
127.0.0.1 thinkphp build environment.test
Step 4: Start Apache and MySQL
In XAMPP Run xampp-control.exe in the installation directory to start the Apache and MySQL services.
Step 5: Access ThinkPHP
Now you can access http://thinkphp build environment.test through the browser to view our ThinkPHP application, as shown in the figure:
Summary
The above are the steps to use XAMPP to build a ThinkPHP development environment. Through practice, we can find that the advantage of configuring Virtual Hosts is that it is more flexible, can support multiple sites, and uses absolute paths to facilitate debugging during the development process. It is also recommended to use editors such as Sublime Text during the development process, and use Composer to manage dependencies.
The above is the detailed content of thinkphp build environment. For more information, please follow other related articles on the PHP Chinese website!