I am trying to use preg_match
to have every photo whose filename is gallery\\album\\U[digits].jpg
be titled "Untitled".
Here is the code:
foreach($photos as $photo){
if (preg_match('.*U[0-9]*\.jpg',$photo)) {
$title = "Untitled";
}
else {
$title = basename($photo,".jpg");
}
}
Any idea why this isn't matching? The title of any of these files ends up being "U2" or "U29".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.