下面的语句将加载所有不以下划线字符开头的图像...
if (!is_dir($file) && preg_match("/^[^_].*\.(bmp|jpeg|gif|png|jpg)$/i", $file))
Run Code Online (Sandbox Code Playgroud)
我需要修改它,以便它只加载带有下划线的DO BEGIN图像.
只需删除字符集上的否定:[^_]变为_:
if (!is_dir($file) && preg_match("/^_.*\.(bmp|jpeg|gif|png|jpg)$/i", $file))
Run Code Online (Sandbox Code Playgroud)