PHP get information about audio files, _php tutorial

Source: Internet
Author: User
Tags flock id3 ord talb unpack

PHP gets information about the audio file,


Project requirements: Now there is an audio file upload function, after uploading PHP need to get the relevant information of this audio file, such as: time, and so on, because this file is placed in the purchase of space, not like ffmpeg such an extension to deal with, then PHP can get this information?

The following is an implementation of a read and write operation using PHP for the header information of the audio file used in the project, mainly for WMA and MP3 two formats for reference.

<?php//audioexif.class.php//use PHP for audio file header information Read and write//currently only support WMA and MP3 two formats, only a few commonly used header information////write information support: Title (name), Artist ( Artist), Copyright, Description (description)//year (age), Genre (genre), Albumtitle (album title)//MP3 and WMA are slightly different, the information returned may be more, but only the above information  can be written//MP3 also support track (tracks number write)//for MP3 file support ID3v1 also support ID3v2, read first v2, write always write v1, if necessary write v2////usage Note: (because WMA uses Unicode access, It is also necessary to mb_convert_encoding () extended//return data and write data are ANSI code, that is, what to display (Chinese _gb2312)////require (' AudioExif.class.php ');//$AE = n EW audioexif;//$file = '/path/to/test.mp3 ';////1. Check that the file is complete (only for WMA, MP3 always returns True)////$AE->checksize ($file);////2. Read the information, return the value by the array of information, the key name explanation see above////print_r ($AE->getinfo ($file));////3. Write the information, the second parameter is a hash array, the key-value, supported by the above, MP3 also support track//require the first parameter of the file path can be written by this program//$pa = Array (' title ' = ' new title ', ' Albumtitle ' =& Gt ' new album name ');//$AE->setinfo ($file, $PA);////Other: The plugin spends a lot of time collecting files and Web pages that look for WMA and MP3, which I hope will be useful to you.//Actually there are many similar programs on the net, but the WMA In too few, only in the win platform through the m$//API to operate, and MP3 also very few can be in the Unix/linux command line operation, so deliberately wrote this module////if you find a bug or submit a patch, or improve it to make it more robust, please let me know.//(for ID3 and WMA file formats and structures should be available on the Internet)//if (!extension_loaded (' MBS Tring ') {trigger_error (' PHP Extension module ' mbstring ' is required for audioexif ', e_user_warning); return true;} The Main classclass audioexif{//public Varsvar $_wma = False;var $_mp3 = false;//constructfunction audioexif () {//No Thing to do}//Check the filesizefunction checksize ($file) {$handler = & $this->_get_handler ($file); if (! $handler) return False;return $handler->check_size ($file);} Get the Infomationsfunction GetInfo ($file) {$handler = & $this->_get_handler ($file); if (! $handler) return False ; return $handler->get_info ($file);} Write the Infomationsfunction SetInfo ($file, $pa) {if (!is_writable ($file)) {trigger_error (' audioexif:file '. $file . "Can not been overwritten ', e_user_warning); return false;} $handler = & $this->_get_handler ($file), if (! $handler) return False;return $handler->set_info ($file, $PA);} Private MeThodsfunction &_get_handler ($file) {$ext = Strtolower (STRRCHR ($file, '. ')); $ret = false;if ($ext = = '. mp3 ') {//Mp3$ret = & $this->_mp3;if (! $ret) $ret = new _mp3exif ();} else if ($ext = = '. wma ') {//Wma$ret = & $this->_wma;if (! $ret) $ret = new _wmaexif ();} else{//Unknowntrigger_error (' Audioexif not supported '. $ext. "File. ', e_user_warning);} return $ret;}} DBCS = Gb2312function DBCS_GBK ($str) {//Strip The Last "\0\0" $str = substr ($str, 0,-2); return mb_convert_encoding ( $str, ' GBK ', ' Ucs-2le ');} gb2312 = Dbcsfunction Gbk_dbcs ($str) {$str = mb_convert_encoding ($str, ' ucs-2le ', ' GBK '); $str. = "\0\0"; return $str ;} File Exifclass _audioexif{var $fd, var $head, var $head _off;var $head _buf;//init the file handlerfunction _file_init ($fp Ath, $write = false) {$mode = ($write? ' rb+ ': ' RB '), $this->fd = @fopen ($fpath, $mode), if (! $this->fd) {trigger_error (' audioexif: '. $fpath. ' Can not is opened with mode '. $mode. ", e_user_warning); return false;} $this->head = false; $this->head_off = 0; $this->head_buf = "; return true;} Read buffer from the HEAD_BUF & move the off pointerfunction _read_head_buf ($len) {if ($len <= 0) return NULL; $bu f = substr ($this->head_buf, $this->head_off, $len), $this->head_off + = strlen ($buf); return $buf;} Read one short valuefunction _read_head_short () {$ord 1 = Ord (substr ($this->head_buf, $this->head_off, 1)); $ord 2 = Ord (substr ($this->head_buf, $this->head_off+1, 1)), $this->head_off + = 2;return ($ord 1 + ($ord 2<<8));} Save the file Headfunction _file_save ($head, $olen, $nlen = 0) {if ($nlen = = 0) $nlen = strlen ($head); if ($nlen = = $olen ) {//Shorterflock ($this->fd, LOCK_EX); Fseek ($this->fd, 0, Seek_set), fwrite ($this->fd, $head, $nlen); Flock ($ THIS-&GT;FD, Lock_un);}  else{//longer, buffer required$stat = Fstat ($this->fd); $fsize = $stat [' Size '];//buf required (4096?) should not be Nlen-olen > 4096 Bar $woff = 0; $roff = $olen;//Read First Bufferflock ($this-&GT;FD, LOCK_EX) fseek ($this->fd, $roff, seek_set), $buf = Fread ($this->fd, 4096);//SEEK to Startfseek ($this- &GT;FD, $woff, Seek_set) fwrite ($this->fd, $head, $nlen); $woff + = $nlen;/SEEK to Woff & write the datado{$buf 2 = $buf; $roff + = 4096;if ($roff < $fsize) {fseek ($this->fd, $roff, seek_set); $buf = Fread ($this->fd, 4096);} Save Last Buffer$len2 = Strlen ($buf 2), fseek ($this->fd, $woff, Seek_set), fwrite ($this->fd, $buf 2, $len 2); $woff + = $len 2;} while ($roff < $fsize); Ftruncate ($this->fd, $woff); Flock ($this->fd, Lock_un);}} Close the Filefunction _file_deinit () {if ($this->fd) {fclose ($this->fd); $this->fd = false;}}} WMA classclass _wmaexif extends _audioexif{var $items 1 = array (' Title ', ' Artist ', ' Copyright ', ' Description ', ' Reserved ' var $items 2 = Array (' Year ', ' Genre ', ' albumtitle ');//Check file size (length) maybe invalid filefunction check_size ($f ile) {$ret = false;if (! $this->_file_init ($file)) return true;if ($this->_init_Header ()) {$buf = Fread ($this->fd), $tmp = Unpack (' h32id/vlen/h8unused ', $buf); if ($tmp [' id '] = = ' 3626b2758e66cf11a6d900aa0062ce6c ') {$stat = Fstat ($this->fd), $ret = ($stat [' size '] = = ($this->head[' len ') + $tmp [ ' Len ']));}} $this->_file_deinit (); return $ret;} Set info (Save the Infos) function Set_info ($file, $PA) {//Check the Pasettype ($PA, ' array '); if (! $this->_file_init ($ File, True)) return false;if (! $this->_init_header ()) {$this->_file_deinit (); return false;} Parse the old header & generate the new header$head_body = "; $st _found = $ex _found = false; $head _num = $this->h ead[' num '];while (($tmp = $this->_get_head_frame ()) && ($head _num > 0)) {$head _num--;if ($tmp [' id '] = = '  3326b2758e66cf11a6d900aa0062ce6c ') {//Standard info//1-4$st_found = true; $st _body1 = $st _body2 = '; $lenx = unpack (' V5 ', $this->_read_head_buf); $tmp [' len ']-= 34; 24for ($i = 0; $i < count ($this->items1); $i + +) {$l = $lenx [$i +1]; $k = $this->items1[$I]; $tmp [' len ']-= $l, $data = $this->_read_head_buf ($l), if (Isset ($pa [$k])) $data = Gbk_dbcs ($pa [$k]); $st _body2. = $ Data: $st _body1. = Pack (' V ', strlen ($data));}  Left Lengthif ($tmp [' len '] > 0 $st _body2. = $this->_read_head_buf ($tmp [' Len ']);//Save to Head_body$head_body. = Pack (' H32vh8 ', $tmp [' id '], strlen ($st _body1. $st _body2) +24, $tmp [' unused ']); $head _body. = $st _body1. $st _body2; $st _body2. = $data;} Save to Head_body$head_body. = Pack (' h32va4 ', ' 3326b2758e66cf11a6d900aa0062ce6c ', strlen ($st _body1. $st _body2) +24, ' $head _body. = $st _body1. $st _body2; $this->head[' num ']++;} Ex not FOUND?IF (! $ex _found) {$inum = 0; $et _body = "; foreach ($this->items2 as $k) {$nbuf = Gbk_dbcs (' wm/'. $k); $vbu F = (Isset ($pa [$k])? Gbk_dbcs ($pa [$k]): ""), $et _body. = Pack (' V ', strlen ($NBUF)). $nbuf. Pack (' vv ', 0, strlen ($vbuf)). $vbuf; $inum + +;} $head _body. = Pack (' h32va4v ', ' 40a4d0d207e3d21197f000a0c95ea850 ', strlen ($et _body) +26, ', $inum); $head _body. = $et _ Body; $this->head[' Num ']++;}  After Save$new_len = strlen ($head _body) +; $old _len = $this->head[' len '];if ($new _len < $old _len) {$head _body. = Str_repeat ("n", $old _len-$new _len); $new _len = $old _len;} $tmp = $this->head; $head _buf = Pack (' H32vvvh4 ', $tmp [' id '], $new _len, $tmp [' Len2 '], $tmp [' num '], $tmp [' unused ']); Head_buf. = $head _body; $this->_file_save ($head _buf, $old _len, $new _len);//Close the file & Return$this->_ File_deinit (); return true;} Get Infofunction Get_info ($file) {$ret = array (); if (! $this->_file_init ($file)) return false;if (! $this->_init_ Header ()) {$this->_file_deinit (); return false;} Get the data from head_buf$head_num = $this->head[' num ');  Num of Head_framewhile (($tmp = $this->_get_head_frame ()) && $head _num > 0) {$head _num--;if ($tmp [' id '] = = ' 3326b2758e66cf11a6d900aa0062ce6c ') {//Standard Info$lenx = unpack (' v* ', $this->_read_head_buf); for ($i = 1; $i & lt;= count ($this->items1); $i + +) {$k = $this->items1[$i-1]; $ret [$k] = DBCS_GBK ($this->_read_head_buf ($lenx [$i]);}} else if ($tmp [' id '] = = ' 40a4d0d207e3d21197f000a0c95ea850 ') {//Extended Info$inum = $this->_read_head_short (); $tmp ['  Len ']-= 26;while ($inum > 0 && $tmp [' len '] > 0) {//attribute Name$nlen = $this->_read_head_short (); $nbuf = $this->_read_head_buf ($nlen);//the flag & Value Length$flag = $this->_read_head_short (); $vlen = $this->_ Read_head_short (); $vbuf = $this->_read_head_buf ($vlen);//Update the xx$tmp[' len ']-= (6 + $nlen + $vlen); $inum--; $nam E = DBCS_GBK ($nbuf), $k = substr ($name, 3), if (In_array ($k, $this->items2)) {//all are string value (refer to Falg for O ther tags) $ret [$k] = DBCS_GBK ($VBUF);}} else{//Skip Onlyif ($tmp [' Len '] >) $this->head_off + = ($tmp [' Len ']-24);}} $this->_file_deinit (); return $ret;} Get the Header?function _init_header () {fseek ($this->fd, 0, seek_set); $buf = Fread ($this->fd, +); if (strlen ($ BUF) = () return false; $tmp = Unpack (' h32id/vlen/vlen2/vnum/H4unused ', $buf); if ($tmp [' id ']! = ' 3026b2758e66cf11a6d900aa0062ce6c ') return false; $this->head_buf = Fread ($this- &GT;FD, $tmp [' Len ']-$this->head = $tmp; return true;} _get_head_frame () function _get_head_frame () {$buf = $this->_read_head_buf, if (strlen ($buf)! =) return False ; $tmp = Unpack (' h32id/vlen/h8unused ', $buf); return $tmp;}} MP3 Class (If not IDv2 then select IDv1) class _mp3exif extends _audioexif{var $head 1;var $genres = Array (' Blues ', ' class IC Rock ', ' country ', ' Dance ', ' Disco ', ' Funk ', ' Grunge ', ' hip-hop ', ' Jazz ', ' Metal ', ' New age ', ' oldies ', ' other ', ' Pop ', ' R ' &b ', ' Rap ', ' Reggae ', ' Rock ', ' Techno ', ' Industrial ', ' alternative ', ' Ska ', ' Death Metal ', ' Pranks ', ' soundtrack ', ' Euro-techno ', ' Ambient ', ' trip-hop ', ' Vocal ', ' jazz+funk ', ' Fusion ', ' Trance ', ' Classical ', ' instrumental ', ' Acid ', ' House ', ' Game ', ' Sound Clip ', ' Gospel ', ' Noise ', ' alternrock ', ' Bass ', ' Soul ', ' Punk ', ' Space ', ' meditative ', ' Instrumental Pop ', ' instrumental Rock ', ' ethnic ', ' Gothic ', ' darkwave ', ' techno-industrial ', ' ElectroniC ', ' pop-folk ', ' eurodance ', ' Dream ', ' Southern Rock ', ' comedy ', ' Cult ', ' Gangsta ', ' Top ', ' Christian Rap ', ' pop/funk ', ' Jungle ', ' Native American ', ' Cabaret ', ' New Wave ', ' psychadelic ', ' Rave ', ' showtunes ', ' Trailer ', ' lo-fi ', ' tribal ', ' Acid Punk ', ' Acid Jazz ', ' Polka ', ' Retro ', ' musical ', ' Rock & Roll ', ' Hard rock ', ' Unknown ');//MP3 always return truefunction Check_size ($file) {return true;} Get Infofunction Get_info ($file) {if (! $this->_file_init ($file)) return false; $ret = false;if ($this->_init_ Header ()) {$ret = ($this->head? $this->_get_v2_info (): $this->_get_v1_info ()); $ret [' meta '] = $this->_get_ Meta_info ();} $this->_file_deinit (); return $ret;} Set Infofunction set_info ($file, $pa) {if (! $this->_file_init ($file, True)) return false;if ($this->_init_ Header ()) {//Always save V1 info$this->_set_v1_info ($PA);//Set V2 first if Need$this->_set_v2_info ($PA);} $this->_file_deinit (); return true;} Get the header Information[v1+v2], call after File_initfunction _init_heAder () {$this->head1 = false; $this->head = false;//try to get ID3v1 Firstfseek ($this->fd, -128, seek_end); $buf = Fread ($this->fd), if (strlen ($buf) = = && substr ($buf, 0, 3) = = ' TAG ') {$tmp = unpack (' a3id/a30title/a30a Rtist/a30albumtitle/a4year/a28description/creserved/ctrack/cgenre ', $buf); $this->head1 = $tmp;} Try to get Id3v2fseek ($this->fd, 0, seek_set), $buf = Fread ($this->fd, ten), if (strlen ($buf) = && subst R ($buf, 0, 3) = = ' ID3 ') {$tmp = unpack (' a3id/cver/crev/cflag/c4size ', $buf); $tmp [' size '] = ($tmp [' size1 ']<<21) | ( $tmp [' size2 ']<<14) | ($tmp [' size3 ']<<7) | $tmp [' size4 '];unset ($tmp [' size1 '], $tmp [' size2 '], $tmp [' Size3 '], $tmp [' size4 ']); $this- >head = $tmp; $this->head_buf = Fread ($this->fd, $tmp [' size ']);} Return ($this->head1 | | $this->head);} Get v1 infofunction _get_v1_info () {$ret = array (); $tmpa = Array (' Title ', ' Artist ', ' Copyright ', ' Description ', ' year ', ' Albumtitle '); foreach ($tmpa as $tmp) {$ret [$tMP] = $this->head1[$tmp];if ($pos = Strpos ($ret [$tmp], "") $ret [$tmp] = substr ($ret [$tmp], 0, $pos);} Count the Genre, [Track]if ($this->head1[' Reserved '] = = 0) $ret [' track '] = $this->head1[' track '];else $ret [' Desc Ription ']. = Chr ($ret [' Reserved ']). Chr ($ret [' track ']),//genre_idx$g = $this->head1[' Genre '];if (!isset ($this->genres[$g]) $ret [' Genre '] = ' Unknown '; else $ret [' Genre '] = $this->genres[$g];//return the value$ret[' id3v1 '] = ' yes '; return $ret;} Get v2 infofunction _get_v2_info () {$ret = array (); $items = Array (' TCOP ' = ' Copyright ', ' TPE1 ' = ' Artist ', ' TIT2 ' = > ' Title ', ' Trck ' + ' track ', ' TCON ' = ' Genre ', ' COMM ' + ' Description ', ' tyer ' = ' year ', ' talb ' and ' = ' Albumtitle '), while (true) {$buf = $this->_read_head_buf, if (strlen ($buf) =) break; $tmp = Unpack (' a4fid/nsize/ Nflag ', $buf); if ($tmp [' size '] = = 0) break, $tmp [' dat '] = $this->_read_head_buf ($tmp [' size ']);//0x6000 (11000000 00000000) if ($tmp [' Flag '] & 0x6000) continue;//mApping the Dataif ($k = $items [$tmp [' FID ']] {//If first char is "\", Just SkipIf (substr ($tmp [' dat '], 0, 1) = = "+") $t mp[' dat '] = substr ($tmp [' Dat '], 1); $ret [$k] = $tmp [' Dat '];}} Reset the Genreif ($g = $ret [' Genre ']) {if (substr ($g, 0,1) = = ' (' && substr ($g, -1,1) = = ') ') $g = substr ($g, 1, -1); if (Is_numeric ($g)) {$g = Intval ($g); $ret [' Genre '] = (isset ($this->genres[$g])? $this->genres[$g]: ' Unknown ' );}} $ret [' id3v1 '] = ' no '; return $ret;} Get meta info of mp3function _get_meta_info () {//seek to the lead Buf:0xff$off = 0;if ($this->head) $off = $this-&G t;head[' size ' + 10;fseek ($this->fd, $off, Seek_set), while (!feof ($this->fd)) {$skip = Ord (fread ($this->fd, 1) if ($skip = = 0xff) break;} if ($skip! = 0xFF) return false; $buf = Fread ($this->fd, 3), if (strlen ($buf)! = 3) return false; $tmp = Unpack (' C3 ', $buf ) if (($tmp [1] & 0xf0)! = 0xf0) return false;//get the meta Info$meta = Array ();//Get MPEG version$meta[' mpeg '] = ($ TMP[1] & 0x08? 1:2);$meta [' layer '] = ($tmp [1] & 0x04)? (($tmp [1] & 0x02)? 1:2): (($tmp [1] & 0x02) 3:0); $meta [' epro '] = ($tmp [1] & 0x01)? ' No ': ' yes ';//bit rates$bit_rates = Array (1 = = Array (1 = = Array ( 0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,0), 2 = = Array ( 0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,0), 3 = = Array ( 0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,0)), 2 = = Array (1 = = Array ( 0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,0), 2 = = Array ( 0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,0), 3 = = Array (0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,0 )); $i = $meta [' mpeg ']; $j = $meta [' layer ']; $k = ($tmp [2]>>4); $meta [' bitrate '] = $bit _rates[$i] [$j] [$k];//sample  Rates
 <采样率>
  
$sam _rates = Array (1=>array (44100,48000,32000,0), 2=>array (22050,24000,16000,0)), $meta [' samrate '] = $sam _ rates[$i] [$k]; $meta ["padding"] = ($tmp [2] & 0x02)? ' On ': ' Off '; $meta ["private"] = ($tmp [2] & 0x01)? ' On ': ' Off ';//mode & mode_ext$k = ($tmp [3]>>6); $channel _modes = Array (' Stereo ', ' joint Stereo ', ' Dual channel ') , ' single channel '), $meta [' mode '] = $channel _modes[$k]; $k = (($tmp [3]>>4) & 0x03); $extend _modes = Array (' Mpg_ Md_lr_lr ', ' Mpg_md_lr_i ', ' mpg_md_ms_lr ', ' mpg_md_ms_i '); $meta [' ext_mode '] = $extend _modes[$k]; $meta [' copyright '] = ( $tmp [3] & 0x08)? ' Yes ': ' no '; $meta [' original '] = ($tmp [3] & 0x04)? ' Yes ': ' no ', $emphasis = Array (' None ', ' 50/15 microsecs ', ' rreserved ', ' CCITT J '); $k = ($tmp [3] & 0x03); $meta [' emph ASIS '] = $emphasis [$k];return $meta;} Set v1 infofunction _set_v1_info ($PA) {//ID3v1 (simpled) $off = -128;if (!) $tmp = $this->head1)) {$off = 0; $tmp [' id '] = ' TAG '; $tmp [' Title '] = $tmp [' Artist '] = $tmp [' Albumtitle ']= $tmp [' year '] = $tmp [' Description '] = ', $tmp [' Reserved '] = $tmp [' track '] = $tmp [' Genre '] = 0;} Basic Items$items = Array (' Title ', ' Artist ', ' Copyright ', ' Description ', ' Year ', ' Albumtitle '); foreach ($items as $k) {i F (Isset ($pa [$k]) $tmp [$k] = $pa [$k];} Genre Indexif (Isset ($pa [' genre ')) {$g = 0;foreach ($this->genres as $gtmp) {if (!strcasecmp ($gtmp, $pa [' genre '])) break; $g + +;} $tmp [' Genre '] = $g;} if (Isset ($pa [' track])) $tmp [' track '] = Intval ($pa [' track ']);//pack The DATA$BUF = Pack (' A3A30A30A30A4A28CCC ', $tmp [' Id '], $tmp [' Title '], $tmp [' Artist '], $tmp [' Albumtitle '], $tmp [' Year '], $tmp [' Description '], 0, $tmp [' track '], $tmp [' Flock ($this->fd, LOCK_EX), fseek ($this->fd, $off, Seek_end), fwrite ($this->fd, $buf, Genre); Flock ($ THIS-&GT;FD, Lock_un);} Set v2 infofunction _set_v2_info ($PA) {if (! $this->head) {//insert Id3return;//Not even/** $tmp = array (' id ' = ' ID3 ') , ' ver ' =>3, ' rev ' =>0, ' flag ' =>0); $tmp [' size '] =-10; +10 = 0$this->head = $tmp; $this->head_buf = "; $this->head_off = 0;**/} $items = Array (' TCOP ' = ' Copyright ', ' TPE1 ' = ' Artist ', ' TIT2 ' = ') Title ', ' TRAC ' = ' track ', ' TCON ' = ' Genre ', ' COMM ' = ' Description ', ' tyer ' = ' year ', ' talb ' and ' = ' Albumtitle '); $head _body = "; while (true) {$buf = $this->_read_head_buf; if (strlen ($buf)! =) break; $tmp = Unpack (' A4fid/nsize/nflag ', $buf), if ($tmp [' size '] = = 0) break, $data = $this->_read_head_buf ($tmp [' size ']); if ($k = $items [$tmp [' FID ']] && isset ($pa [$k]) {//The data should prefix by "+" [replace] $data = "". $pa [$k];unset ($pa [$k]);} $head _body. = Pack (' a4nn ', $tmp [' FID '], strlen ($data), $tmp [' flag ']). $data;} Reverse the items & Set the new Tags$items = Array_flip ($items); foreach ($pa as $k = = $v) {if ($fid = $items [$k]) {$head _body. = Pack (' A4nn ', $fid, strlen ($v) + 1, 0). "." $v;}} New Length$new_len = strlen ($head _body) + ten $old _len = $this->head[' size ' + 10;if ($new _len < $old _len) {$head _b Ody. = Str_repeat ("+", $old _len-$new _len) $new _len = $old _len;}  Count the size1,2,3,4, no include the header//more perverted algorithm ...:p (28bytes integer) $size = Array (); $nlen = $new _len-10;for ($i = 4; $i > 0; $i--) {$size [$i] = ($nlen & 0x7f); $nlen >>= 7;} $tmp = $this->head;//echo "Old_len: $old _len new_len: $new _len\n"; $head _buf = Pack (' A3CCCCCCC ', $tmp [' id '], $tmp [' ver '], $tmp [' rev '], $tmp [' flag '], $size [1], $size [2], $size [3], $size [4]); $head _buf. = $head _body; $this->_file_save ($ Head_buf, $old _len, $new _len);}
 

The above mentioned is the whole content of this article, I hope you can like.

http://www.bkjia.com/PHPjc/1020538.html www.bkjia.com true http://www.bkjia.com/PHPjc/1020538.html techarticle PHP Get information about audio files, project requirements: Now there is an audio file upload function, after uploading PHP need to get the relevant information of this audio file, such as: time, etc. ..

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.