glob文件夹下命名不含下划线的所有文件

WBOY
Release: 2016-06-23 13:34:51
Original
1068 people have browsed it

glob文件夹下命名不含下划线的所有文件,请问怎么写正则?


回复讨论(解决方案)

你循环的时候直接用 strpos 判断是否有下划线不就行了
好像 glob 不能用复杂的正则

你循环的时候直接用 strpos 判断是否有下划线不就行了
好像 glob 不能用复杂的正则


我试了一下,这种可以:
glob($datapath.'/NG/[0-9][0-9][0-9][0-9].*', GLOB_BRACE);
Copy after login


还有简便一点的方法吗?

preg_grep('/[^_]/', glob($path))

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template