【发布时间】:2015-09-14 23:17:13
【问题描述】:
我需要检查文件夹内的文件是否包含'_' 符号。我使用 glob 函数从服务器位置获取文件。但我不知道检查文件名是否包含文件名中任何位置的符号。
我的文件具有以下格式的名称。 student_178_grade1A
我已经这样做了。
$report_files=glob( '/user_uploads/' . '/reportcards/' . 'term' . '_' . 10.'/*'.'.pdf' );
//this will return all files inside the folder.
if(count(report_files)>0)
{
//some stuff
}
else
{
}
我需要获取文件名中包含“_”的文件。我试过了
glob( '/user_uploads/' . '/reportcards/' . 'term' . '_' . 10.'/*[_]'.'.pdf' );
但它不起作用
【问题讨论】: