
花都网络公司PHP在电影图象中的妙用 归并汉英字幕
英文字幕:100:00:00,750 --> 00:00:02,350previously on prison break:200:00:02,380 --> 00:00:05,000Give me the number for a sundown tel,please?中文字幕:100:00:00,750 --> 00:00:02,350逃狱前情撮要200:00:02,380 --> 00:00:05,000请帮我查下Sundown旅店的德律风归并后:1 00:00:00,750 --> 00:00:02,350 逃狱前情撮要 previously on prison break: 2 00:00:02,380 --> 00:00:05,000 请帮我查下Sundown旅店的花都网站设计花都网站制作花都网站制作花都网站建设德律风 Give me the number for a sundown tel,please? PHP代码:
[Copy to clipboard]
CODE:<?////////////////////////////上面是英文脚本部份收集////////////////////////////$cc=0; //数组起头量$filename = "./en.txt";$handle = file($filename);$enew = array();$total = array();$cc_total = 0;$cc_e_total = 4;$en_start =0;foreach ($handle as $key => $value){ if(ereg("^[1-9]",$value)){ if ($value==($en_start+1)) { $enew[$cc]=$key+2; //+2是为了把文字部份定位 因为数字和文字差两行。$gb_key+2为txt文本中文字地点的花都网站建设花都网站建设花都网站制作行数。 $cc++; $en_start++; } }}reset($handle); //把英文脚本指针前往第一个。//上面是中文$gb_cc=0;$gb_start = 0;$gb_filename = "./gb.txt";$gb_handle = file($gb_filename);$gb_new = array();foreach ($gb_handle as $gb_key => $gb_value) //$gb_handle是$gb_handle[0]=1 $gb_handle[1]=00:33:47,890 --> 00:33:48,610 { if(ereg("^[1-9]",$gb_value)){ if ($gb_value==($gb_start+1)) { $gb_new[$gb_cc]=$gb_key; //+2是为了把文字部份定位 因为数字和文字差两行。$gb_key+2为txt文本中文字地点的花都网站设计行数。 $gb_cc++; $gb_start++; } }}reset($gb_handle); //把英文脚本指针前往第一个。foreach ($gb_new as $new_key => $new_value) //中文在先$new_value起头于0{ $total[$cc_total]=$gb_handle[$new_value]; $total[$cc_total+1]=$gb_handle[$new_value+1]; $total[$cc_total+2]=$gb_handle[$new_value+2]; $total[$cc_total+3]=$gb_handle[$new_value+3]; //上面四个为中文 INDEX 和时候 和两行形式 $cc_total=$cc_total+7; //指针挪动到$total[7]}foreach ($enew as $e_new_key => $e_new_value){ $total[$cc_e_total]=$handle[$e_new_value]; $total[$cc_e_total+1]=$handle[$e_new_value+1]; $cc_e_total=$cc_e_total+7;}$total_count=count($total);for($e=0;$e<$total_count;$e++){ echo $total[$e]."<br />"; }?>
更多,请点击:http://www.phpchina.com/bbs/thread-11911-1-1.html
