Ultra Fractal 批量处理备份
【摘要】
<?php $dir = "../Pic/"; $filearray = scandir($dir); $listArray = Array(); foreach ($filearray as $f){ if ($f != null ){ $temp = explode(".", $f); if ($temp[1]=...
-
<?php
-
-
$dir = "../Pic/";
-
$filearray = scandir($dir);
-
$listArray = Array();
-
-
foreach ($filearray as $f){
-
if ($f != null ){
-
$temp = explode(".", $f);
-
if ($temp[1]=="ugr"){
-
array_push($listArray,$temp[0]);
-
}
-
}
-
}
-
-
//$save = fopen($dir."风格.ugr", "a+");
-
$ugrString2 = "";
-
$index = 1;
-
-
//最终字符串
-
$finalString = "";
-
-
foreach ($listArray as $l){
-
$path = $dir.$l.".ugr";
-
$ugrString = file_get_contents($path);
-
$ugrlist = explode(" {", $ugrString);
-
$index2 = $index;
-
$resultString = "";
-
for($i=0;$i<count($ugrlist);$i++){
-
-
if($i!=0){
-
if($index<10){
-
//echo "00".$index."{".$ugrlist[$i];
-
$resultString =$resultString."00".$index."{".$ugrlist[$i];
-
} else if($index>=10 and $index<100){
-
//echo "0".$index."{".$ugrlist[$i];
-
$resultString =$resultString."0".$index."{".$ugrlist[$i];
-
} else {
-
//echo $index."{".$ugrlist[$i];
-
$resultString =$resultString.$index."{".$ugrlist[$i];
-
}
-
$index++;
-
}else {
-
//echo $ugrlist[$i];
-
$resultString =$ugrlist[$i];
-
}
-
-
} //end { 处理
-
//echo $resultString;
-
-
//将$resultString进行切割,对title属性行排序
-
$resultlist = explode("\" smooth", $resultString);
-
-
$resultString2 = "";
-
for($j=0;$j<count($resultlist);$j++){
-
if($j!=0){
-
if($index2<10){
-
$resultString2 =$resultString2."00".$index2."\" smooth".$resultlist[$j];
-
} else if($index2>=10 and $index2<100){
-
$resultString2 =$resultString2."0".$index2."\" smooth".$resultlist[$j];
-
} else {
-
$resultString2 =$resultString2.$index2."\" smooth".$resultlist[$j];
-
}
-
$index2++;
-
//echo "<br/>".$resultString2."<br/>";
-
} else {
-
$resultString2 =$resultlist[$j];
-
}
-
}
-
echo $resultString2;
-
}
-
-
?>
文章来源: blog.csdn.net,作者:fengda2870,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/fengda2870/article/details/6754159
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)