1, the MVC

ThinkPHP supports traditional MVC (Model-View-Controller) mode M: Model Model, specifically responsible for data operations, for the database part of the code. A model (class) for a data table. V: View, specifically responsible for the result data rendering (HTML+CSS+Javascript). C: Controller A Controller that processes all services. A controller controls a class of services.

2. Import files

ThinkPHP6.0 uses a single entry point model for project deployment and access, where each application has a unified (but not necessarily unique) entry point. The entry file is located under the public directory. The most common entry file is index.php. Thinkphp6 supports multiple applications with multiple entries

3. Full URL

Access the address: www.mytp6.com/index.php/i…

  • index.phpEntry file, is the root directorypublic/Under theindex.php
  • indexControllers, there’s one in the directorycontrollerController directoryIndex.php
  • indexOperation,Index.phpThe operation method under the controller is the smallest unit of URL access.

Apache hides entry files

  1. httpd.confLoaded in the configuration filemod_rewrite.soThe module
  2. AllowOverride NoneChange None to All
  3. Save the following as.htaccessThe file is stored in the same directory as the application entry file
<IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine On RewriteCond %{REQUEST_FILENAME} ! -d RewriteCond %{REQUEST_FILENAME} ! -f RewriteRule ^(.*)$ index.php? / $1 [QSA,PT,L]
</IfModule>
Copy the code

6. Nginx hides entry files

Save the following contents as the nginx.htaccess file in the same directory as the application entry file

location / {
  if(! -e$request_filename) { rewrite ^(.*)$ /index.php? s=/$1last; }}Copy the code