Function code that batch modifies the file suffix in php. Copy the code as follows :? PhpfunctionforeachDir ($ path) {$ handleopendir ($ path); if ($ handle) {while (false! ($ Filereaddir ($ handle) {if ($ file !. $ File !..) {If (is_di
The code is as follows:
Function foreachDir ($ path ){
$ Handle = opendir ($ path );
If ($ handle ){
While (false! ==( $ File = readdir ($ handle ))){
If ($ file! = "." & $ File! = '..'){
If (is_dir ($ path. $ file )){
Echo $ path. $ file ."
";
ForeachDir ($ path. $ file );
} Else {
Echo "--". $ path. "/". $ file ."
";
$ Ext = strripos ($ file ,'.');
$ Aaa = substr ($ file, 0, $ ext );
Rename ($ path. '/'. $ file, $ path. '/'. $ aaa. '. JPG ');
// Die ();
}
}
}
Return false;
}
}
ForeachDir ('d: \ xampp \ htdocs \ TNF2 ');
The http://www.bkjia.com/PHPjc/324514.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/324514.htmlTechArticle code is as follows :? Php function foreachDir ($ path) {$ handle = opendir ($ path); if ($ handle) {while (false! ==( $ File = readdir ($ handle) {if ($ file! = "." $ File! = '...') {If (is_di...