您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php如何修改文件后缀名

2024/5/7 2:57:44发布24次查看
php修改文件后缀名的方法:首先创建php文件;然后定义一个“changetypename”方法;接着获取文件绝对路径;最后通过“rename($filerealpath, $compresscssfilerealpath);”修改即可。
推荐:《php视频教程》
php 改变文件目录下文件的后缀名
changetypename("e:/bak/video/code/views", "html", "phtml"); //改变文件目录下文件的后缀名function changetypename($path, $oldtypaname, $newtypename){ $path = "glob://$path/*"; $files = new directoryiterator($path); foreach ($files as $file) { $filerealpath = $file->getrealpath(); //文件绝对路径 $compresscssfilerealpath = str_replace(".$oldtypaname", ".$newtypename", $filerealpath); rename($filerealpath, $compresscssfilerealpath); }}
以上就是php如何修改文件后缀名的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product