欢迎各位兄弟 发布技术文章
这里的技术是共享的
<a href="javascript:void(0);" class="tubofang-index"> | |
<div class="oneshiping-index-tu"> | |
<img src="/uploads/shiping/dspzq/xszp.jpg" alt="学生作品" width="100%"> | |
<span class="shichang"><script src=/plus/getshichang.php?path=/uploads/shiping/dspzq/xszp.mp4 type='text/javascript' language=javascript></script></span> | |
</div> | |
</a> |
getshichang.php 文件如下
<?php
$rootpath = $_SERVER['DOCUMENT_ROOT'];
require_once(dirname(__FILE__)."/../include/common.inc.php");
if(isset($path)) {
$filepath_pic = $rootpath.$path;
$pathtxt = str_replace('/','_',$path);
$pathtxt = 'shichang/'.substr($pathtxt,0,strpos($pathtxt,'.')).'.txt';
if($previewurl_time = file_get_contents($pathtxt)){
echo "document.write('".$previewurl_time."');\r\n";
exit;
}
include_once '../include/getid3-master/getid3/getid3.php';
$getID3 = new getID3;
$ThisFileInfo = $getID3->analyze($filepath_pic); //分析文件,$path为音频文件的地址
$fileduration= $ThisFileInfo['playtime_seconds'];
$hours=intval($fileduration/3600);
if($hours<10 && $hours>=1){
$hours = '0'.$hours;
}else if($hours<1){
$hours='';
}
$minute = intval(($fileduration%3600)/60);
if($minute<1 ){
$minute = '00';
}
else if($minute<10 ){
$minute = '0'.$minute;
}
$second = intval($fileduration%60);
if($second<10){
$second = '0'.$second;
}
$previewurl_time = $minute.':'.$second;
if(!empty($hours)){
$previewurl_time = $hours.':'.$previewurl_time;
}
file_put_contents($pathtxt,$previewurl_time);
echo "document.write('".$previewurl_time."');\r\n";
exit();
}
?>