分析错误:语法错误,意外的'>';,期望函数(T_function)


Parse error: syntax error, unexpected '?>', expecting function (T_FUNCTION)

我一切都正确,我已经关闭了php标记的?>,它仍然显示错误:

分析错误:语法错误,意外'''?>''',期望函数(T_function)

这是我的代码:

<?php
class IWP_MMB_ErrorLog extends IWP_MMB_Core {
    function __construct() {
        parent::__construct();
    }

    function get_errorLog($args) {
        $myfile = fopen(ini_get('error_log'), "r") or die("Unable to open file!");
        // Output one line until end-of-file
        while (!feof($myfile)) {
            $string = fgets($myfile);
            $ar = explode("]", $string);
            if (!empty($ar[0])) {
                $remove = trim($ar[0], "[");
                $remove1 = trim($remove, "UTC");
            }
            if (!empty($ar[1]) && !empty($ar[0])) { 
                $error_data[] = array(
                    'date' => $remove1,
                    'content' => $ar[1],
                );
            }
        }
        fclose($myfile);
        return $error_data; 
    }
}
?>

我在使用NetBeans时也遇到了类似的问题。这个文件看起来很好,但我得到的错误和你一样。我想NetBeans需要一些配置,但有帮助的是创建一个新文件,复制粘贴里面的所有内容,并重命名文件。。。肮脏的解决方案,但有效。。。