TP5.0 access path method

Open the URL and enter http://localhost/tp5/public/

You can access the following interface:

微信图片_20180307122708.png

Default In this case, the URL is not case-sensitive, which means that the module/controller/operation name in the URL will be automatically converted to lowercase, and the controller will be converted to camel case when it is finally called.

For example:

http://localhost/index.php/Index/Blog/read// is equivalent to the following access
http://localhost/index. php/index/blog/read

If you access the following address

http://localhost/index.php/Index/BlogTest/read// and the following access are etc. Effective
http://localhost/index.php/index/blogtest/read

In this case, the URL is not case-sensitive, if you want to access the camel case controller class, You need to use:

http://localhost/index.php/Index/blog_test/read

The module name and operation name will be directly converted to lower case.

If you want URL access to be strictly case-sensitive, you can set it in the application configuration file:

// Turn off the automatic conversion of controller and operation names in the URL 'url_convert' => false,

Once automatic conversion is turned off, the controller name in the URL address becomes case-sensitive. For example, the previous access address must be written as:

http://localhost/ index.php/Index/BlogTest/read

But the following URL access is still valid:

http://localhost/index.php/Index/blog_test/read

The following URL access is invalid:

http://localhost/index.php/Index/blogtest/read

Hidden entry file

In ThinkPHP5.0, due to the principle of optimized URL access, it also supports hiding entry files through URL rewriting. The following uses Apache as an example to illustrate the setting of hiding the application entry file index.php.

The following is the configuration process of Apache, you can refer to it:
1. The mod_rewrite.so module is loaded in the httpd.conf configuration file
2. AllowOverride None Change None to All
3 , add the .htaccess file in the same directory as the application entry file, with the following content:

<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php/ [QSA,PT,L]
</IfModule>


Continuing Learning
||
<?php echo "url访问问题";
submitReset Code