<?php
/*
* PHP合并ts文件
* @version : 最原始alpha版
* @author https://blog.csdn.net/RoadToTheExpert
*/
function combine_ts() {
$dir = 'E:\1\2';//ts 文件所在目录
$out_ts = 'test';//输出合并后的文件名
$files = scandir($dir);
$cmd = '';
foreach ($files as $f) {
if( is_file($dir . '\\' . $f) ) {
if( pathinfo($f, PATHINFO_EXTENSION) == 'ts' ) {
if( $cmd == '' ) {
$cmd = 'copy ';
} else {
$cmd .= '+';
}
$cmd .= $f . '/b';
}
}
}
$cmd .= ' ' . $out_ts . '.ts ';
//echo $cmd;
$out_ts = $dir . '\\_' . $out_ts . '.bat';
echo $out_ts;
file_put_contents( $out_ts, $cmd);
}
//免责声明:程序仅作参考,切莫要用作不良行为哦!
combine_ts();