无为清净楼资源网 Design By www.qnjia.com
我们在使用PHP语言的时候会遇到转换图片文件的需求。如果实现批量转换的话,就能节约大量的时间。下面我们就为大家具体讲解有关phpCB批量转换的方法。
最近需要整理一个整站的php代码规范视图,前几天发现phpCB整理视图非常好,但有个缺点是不能批量处理,使用过程中发现phpCB是一个CMD程序,马上就想到php的system函数调用cmd,想到就做,下面是phpCB批量转换的php程序:
复制代码 代码如下:
< ?
header("Content-type: text/html; charset=gb2312");
define('ROOT_PATH', dirname(__FILE__));
$topath="ww"; //要格式化视图的目录名,前后都不要“/”
$path=ROOT_PATH."/".$topath;
$arr=get_all_files($path);
for($i=0;$i<count($arr);$i++)
{
$phpext=fileext($arr[$i]);
if($phpext=="php")
{
$cmd="phpCB.exe ".$arr[$i]." > ".$arr[$i].".phpCB";
system($cmd);
unlink($arr[$i]);
@rename($arr[$i].".phpCB",$arr[$i]);
}
}
function get_all_files($path){
$list = array();
foreach(glob($path . '/*') as $item){
if(is_dir($item)){
$list = array_merge($list , get_all_files( $item ));
} else {
$list[] = $item;
}
}
return $list;
}
function fileext($filename) {
return trim(substr(strrchr($filename, '.'), 1, 10));
}
?>
phpCB批量转换的使用方法:把phpCB.exe放在windows/system32/目录下,php执行程序和要转换的文件夹放同一级路径,先配置$topath,然后在浏览器里访问本程序,没有结果输出。
最近需要整理一个整站的php代码规范视图,前几天发现phpCB整理视图非常好,但有个缺点是不能批量处理,使用过程中发现phpCB是一个CMD程序,马上就想到php的system函数调用cmd,想到就做,下面是phpCB批量转换的php程序:
复制代码 代码如下:
< ?
header("Content-type: text/html; charset=gb2312");
define('ROOT_PATH', dirname(__FILE__));
$topath="ww"; //要格式化视图的目录名,前后都不要“/”
$path=ROOT_PATH."/".$topath;
$arr=get_all_files($path);
for($i=0;$i<count($arr);$i++)
{
$phpext=fileext($arr[$i]);
if($phpext=="php")
{
$cmd="phpCB.exe ".$arr[$i]." > ".$arr[$i].".phpCB";
system($cmd);
unlink($arr[$i]);
@rename($arr[$i].".phpCB",$arr[$i]);
}
}
function get_all_files($path){
$list = array();
foreach(glob($path . '/*') as $item){
if(is_dir($item)){
$list = array_merge($list , get_all_files( $item ));
} else {
$list[] = $item;
}
}
return $list;
}
function fileext($filename) {
return trim(substr(strrchr($filename, '.'), 1, 10));
}
?>
phpCB批量转换的使用方法:把phpCB.exe放在windows/system32/目录下,php执行程序和要转换的文件夹放同一级路径,先配置$topath,然后在浏览器里访问本程序,没有结果输出。
标签:
phpCB,批量,转换
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
更新日志
2024年09月23日
2024年09月23日
- 华少翌.2005-华少翌【中唱艺能】【WAV+CUE】
- 群星《十二女声Ⅱ》[WAV/CUE/分轨][527MB]
- 大自然音乐系列《漫步在山裡》[WAV/CUE/分轨][502.8MB]
- 大自然音乐系列《星光夜语》[WAV/CUE/分轨][453.3MB]
- 史依弘《史依弘交响乐京剧演唱专辑HQ》头版限量编号[WAV+CUE]
- 曼丽2020《女人三十风继续吹》HQCD[WAV+CUE]
- 曼丽2021《女人三十2雾之恋》HQCD[WAV+CUE]
- 隔壁老樊.2019-我曾【好听音乐】【FLAC分轨】
- 高林生.1993-牵挂你的人是我【白天鹅】【WAV+CUE】
- 洪卓立.2012-找个懂我的女孩(国专)【英皇娱乐】【WAV+CUE】
- 曼丽2022《女人三十3晚秋》HQCD[WAV+CUE]
- 曼丽2018《女人三十4冬天》HQCD[WAV+CUE]
- 柏菲-《好歌30年壹》限量开盘母带ORMCD[低速原抓WAV+CUE]
- 大自然音乐系列《水舞》[WAV/CUE/分轨][424.3MB]
- 大自然音乐系列《星光夜语》[WAV/CUE/分轨][453.3MB]