【问题标题】:getID3 get mp3 length unexspected T_ECHOgetID3 获取 mp3 长度意外的 T_ECHO
【发布时间】:2014-02-17 09:52:39
【问题描述】:

我想在 PHP 中获取 MP3 文件的长度。我通过 google 找到的代码来自 getID3,但它不起作用。

我总是收到以下错误消息,但我不知道该如何解决。

PHP Parse error: syntax error, unexpected T_ECHO in /.../getDuration.php on line 17

我的 PHP 代码:

<?php

$include = dirname(__FILE__). '/';

include_once $include . 'getid3.php';
include_once $include . 'getid3.lib.php';
include_once $include . 'module.audio.mp3.php';
include_once $include . 'module.tag.apetag.php';
include_once $include . 'module.tag.id3v1.php';
include_once $include . 'module.tag.id3v2.php';


$pathName = '/var/..../audio/audio.mp3';

$getID3 = new getID3;
$ThisFileInfo = $getID3->analyze($pathName)
echo $ThisFileInfo['playtime_string'];

?>

【问题讨论】:

    标签: php mp3 id3 getid3


    【解决方案1】:

    你错过了这一行末尾的分号

    $ThisFileInfo = $getID3->analyze($pathName);
                                             //^------ Add one here 
    

    【讨论】:

    • 但是知道我收到消息 undefined index: playtime_string 你也许知道为什么?
    • 你能把var_dump($ThisFileInfo); 的输出而不是echo 贴出来吗?
    • 啊,现在可以了。 var_dump 是一个好主意,它告诉我这一点。 "Caught exception: Required module.tag.lyrics3.php is missing. 包含 php 文件后一切正常。坦克你非常。 :-)
    • @SnowN,当你被卡住时总是做一个var_dump .. 也总是启用错误报告.. &lt;?php error_reporting(-1); 在上面。很高兴你成功了。
    猜你喜欢
    • 1970-01-01
    • 2013-09-07
    • 1970-01-01
    • 2021-08-30
    • 2010-11-15
    • 1970-01-01
    • 2012-12-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多