This article describes how to convert file names in case based on the operating system in php. For more information, see
This article describes how to convert file names in case based on the operating system in php. For more information, see
In php development, we need to include a file. The common code is as follows:
The Code is as follows:
If (is_file ($ fileName ))
Require $ flleName;
In windows and linux, there is no question: Assume that a d:/web/webServer/A. php file must be included.
D:/web/webServer/. when php is running in windows, the D:/web/webServer/. php is included, because windows does not differentiate the size, and an error will be reported in linux.
What makes windows load case sensitive? The Code is as follows:
The Code is as follows:
If (is_file ($ fileName )){
// The current operating system of PHP_ OS
If (strstr (PHP_ OS, 'win ')){
// Realpath ($ fileName) will convert the file name's case sensitivity/web/A. php if A. php does not exist and a. php will return/web/a. php
If (basename (realpath ($ fileName) = basename ($ fileName ))
Require $ fileName;
Else
Echo 'check the case sensitivity of the file ';
} Else
Require $ fileName;
}