I have everything correct and I have closed ?>
the php tag and it still shows the error:
Parse error: syntax error, unexpected \'?>\', expecting function (T_FUNCTION)
This is my code:
<?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;
}
}
?>
?>
is redundant and MIGHT cause problems with any kind of header directives... – ITroubs?>
) is indeed, not needed, if there isn't anything else after it. It does not cause any kind of problems by itself; the presence of whitespace characters (spaces, new lines) after it causes the header problems. It's a good practice to not mixHTML
andPHP
in the same file and if you follow it then the next step is to get rid of the closing PHP tag in the PHP files. – axiac}
somewhere. I cannot see where in what you posted, triple check your own local code. – deceze