The project encountered a problem, need to put all the files do not conform to the naming rules, such as the inclusion of spaces, including Chinese, including capital letters.
Laravel 5.1 can be directly used to traverse, the specific methods are as follows:
Public Function Allfiles () {
$files = storage::allfiles (' Leveldata ');
foreach ($files as $key => $value) {
$a 1 = explode ('. ', $value);
if (Preg_match ('/[a-z]/', $a 1[1])) {
$daxie [] = $value;
}
if (Preg_match ('/\s+/', $value)) {
$space [] = $value;
}
#匹配中文
if (preg_match ('/[\x{4e00}-\x{9fa5}]+/u ', $value)) {
$hanzi [] = $value;
}
}
echo "<pre>";
Echo '
Run the error, said the directory is beyond the root range, check the data, need to modify:
I changed it directly to the Web server root directory. Problem solving:
D:\phpStudy\WWW\xx\config\filesystems.php
' Disks ' => [' local
' => ['
driver ' => ' local ',
' root ' => ' d:/phpstudy/www ',
//' root ' => s Torage_path (' app '),
],
Online regular match:
http://tool.oschina.net/regex/#