Allow Nginx to support thinkphp URL rewriting and PathInfo
Enable the thinkphp to operate correctly on Nginx.
Simply add the following information in the configuration file to allow Nginx to parse the thinkphp website correctly.
?
?
ThinkPHP supports providing friendly URLs through PATHINFO and URLrewrite. you only need to set tags in the configuration file: The Nginx web search method does not work for a day, we found that the following configuration can perfectly support 'URL
Nginx under the conf/nginx.conf or their own vhostsChange the previous parametersLocation/{root HTML;Index index.html index.htm index.php;Try_files $uri/index.php$uri;if (!-e $request _filename) {Rewrite ^/sub-directory Name/(. *) $/subdirectory
Allow Nginx to support thinkphp URL rewriting and PathInfo
Enable the thinkphp to operate correctly on Nginx.
Simply add the following information in the configuration file to allow Nginx to parse the thinkphp website correctly.
?
?
First set up in the thinkphp configuration fileURL access mode for rewrite mode' Url_model ' = ' 2 ',Then in the nginx.conf file, find this statement #access_log Logs/host.access.log main;Find Location/{} This statement paragraphLocation/{
Thinkphp 3.1.2 The Official Handbook, section 16.2, "Hidden index.php", mentions hiding index in Ngnix.PHP implements a SEO-friendly approach, which uses the following code location/ { if(!-E$request _filename) {rewrite^ (. *) $/index.php?s=$1Last
My code in the WNMP environment is running normally, but in the LNMP environment found that ThinkPHP5 pathinfo failure, resulting in route:rule also can not use. Even according to the official website to add some code is only useful home page, click
[PHP]
if (Isset ($_server[' path_info ')) {
$str =substr ($_server[' path_info '],0,strpos ($_server[' path_info '], '. '));
Get path information (pathinfo)
$pathinfo =explode ('/', trim ($str, '/'));
Get $_get[' m ']
$_get[' m ']= (!emptyempty
In php, there is a built-in function pathinfo, which can easily obtain the file extension, file name, and other information! The pathinfo () function is used to return the file path information in an array. This article provides some usage and
The MVC scheduler and template class adjust the parameter setting method.
New common routing mode
The pathinfo mode supports pseudo-static
Pathinfo now supports custom routing
TVal = array ();}/*** set the template file directory * @ param
The specific steps are as follows:Modify the following code in the site/wp-includes/class-wp.php
The code is as follows
Copy Code
if (Isset ($_server[' path_info '))$pathinfo = $_server[' path_info '];Else$pathinfo =
This article describes the request and response usage of YII framework learning. Share to everyone for your reference, specific as follows:
The CHttpRequest is provided in Yii and encapsulates the commonly used method of request. The specific code
One of my customers has the demand: Upload files, can be doc,docx,xls,pdf,txt format, now need to read the contents of these files in PHP, and then calculate the number of words in the file.
1.PHP read DOC-formatted files
PHP does not have a class
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.