PHP fread()期望参数1是资源,给定布尔值

时间:2018-02-05 22:19:49

标签: php fopen fseek feof

我有这个错误,本地服务器上的东西工作正常,但现在当我将文件上传到托管我得到这些错误。

  • fread()期望参数1为资源,布尔值为
  • fseek()期望参数1为资源,布尔值为
  • feof()期望参数1为资源,布尔值为

需要一些帮助..

PHP脚本:

public function getDuration($use_cbr_estimate=false)
    {
        $fd = fopen($this->filename, "rb");

        $duration=0;
        $block = fread($fd, 100);
        $offset = $this->skipID3v2Tag($block);
        fseek($fd, $offset, SEEK_SET);
        while (!feof($fd))
        {
            $block = fread($fd, 10);
            if (strlen($block)<10) { break; }
            //în căutarea pentru 1111 1111 111 (biți de sincronizare a cadrelor)
            else if ($block[0]=="\xff" && (ord($block[1])&0xe0) )
            {
                $info = self::parseFrameHeader(substr($block, 0, 4));
                if (empty($info['Framesize'])) { return $duration; } //unele fișiere mp3 corupte
                fseek($fd, $info['Framesize']-10, SEEK_CUR);
                $duration += ( $info['Samples'] / $info['Sampling Rate'] );
            }
            else if (substr($block, 0, 3)=='TAG')
            {
                fseek($fd, 128-10, SEEK_CUR);//sărim peste dimensiunea etichetei id3v1
            }
            else
            {
                fseek($fd, -9, SEEK_CUR);
            }
            if ($use_cbr_estimate && !empty($info))
            { 
                return $this->estimateDuration($info['Bitrate'],$offset); 
            }
        }
        return round($duration);
    }

0 个答案:

没有答案
相关问题