PHP matches Chinese, Chinese characters

Source: Internet
Author: User

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/#

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.