Use preg_replace to replace the file date with regular expressions. The example is for reference only.
$ String = 'Certificate _11.20._0415112452.20..doc '; <br/> $ uniqname = '_'. date ("mdhis"); <br/> echo "$ string <br>"; <br/> // find the last "_", then extract the text before _ <br/> $ pattern = "/^ (. *)/_ (/D *)/. (. *)/"; <br/> $ replacement =" $1 $ uniqname "; <br/> $ str1 = preg_replace ($ pattern, $ replacement, $ string ); <br/> echo "str1: $ str1 <br>"; <br/> // find the first ". ", and then intercept. subsequent text <br/> // $ pattern = "/([^/.] *)/. (. *) $/"; <br/> // $ replacement =" $2 "; <br/> // $ str2 = preg_replace ($ pattern, $ replacement, $ string); <br/> // by finding the date after _, overwrite with the original data <br/> mb_internal_encoding ("UTF-8 "); <br/> $ str3 = $ str1. mb_substr ($ string, mb_strlen ($ str1); <br/> echo "$ str3 <br> ";