In PHP development, when we want to include a certain file, the usual code is like this:
Copy code The code is as follows:
if(is_file($fileName))
require $flleName;
There is no problem when running under windows and linux: Suppose now you want to include a file D:/web/webServer/A.php
D:/web/webServer/a.php was misrepresented when passing the value. When running under windows, D:/web/webServer/A.php will also be included, because windows is not size-sensitive. If you put it under linux, an error will be reported
How about making it case-sensitive when loading in windows? The code is as follows:
Copy code The code is as follows:
if(is_file($fileName)){
//PHP_OS currently running Operating system
if(strstr(PHP_OS,'WIN')){
//realpath($fileName) will convert the case of the file name /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 'Please check the file Case ';
}else
require $fileName;
}
http://www.bkjia.com/PHPjc/825313.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825313.htmlTechArticleIn the development of PHP, we want to include a certain file. The usual code is like this: Copy the code and the code is as follows: ? php if(is_file($fileName)) require $flleName; It doesn’t work under windows or linux...