Wednesday 19 December 2018

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

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:





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;
}
}


?>

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...