Using php to modify the suffix of a specified file recently changes the suffix of asp to php. I think php and Qt are both advanced languages. generally, advanced languages provide functions for adding, deleting, modifying, and querying the obtained content. As a result, I searched the internet and found a lot, so I summarized some of my experiences.
Objective: to change the asp suffix in the current directory to php without affecting other "files in the suffix format", and only for the "current folder ", do not modify the files in the current folder.
The code is as follows:
"; // ForeachDir ($ dirname. $ file); // if the comment is removed, the folder file in the folder will be recursively modified} else {echo "--". $ dirname. "/". $ file."
"; $ Temp = substr ($ file, strrpos ($ file ,'. ') + 1); // Obtain the suffix format if ($ temp = "asp") {$ pos = strripos ($ file ,'. '); // get the location of the file name $ filename = substr ($ file, 0, $ pos); // Get the rename ($ dirname. '/'. $ file, $ dirname. '/'. $ filename. '. php '); // replace it with the php suffix format. }}}} ForeachDir ('../traverseMendFilename');?>
Also: attach four methods to get the file extension: http://www.jb51.net/article/29765.htm