好的,所以我的 PHP 至少可以说是可怕的。我继承了一个应用程序,并且必须从 7 年前编写它的人那里修复其中的错误。当我运行页面时,没有返回,所以我检查了日志以查看错误,这是我得到的:
PHP Parse 错误:语法错误,意外 '=',期望 ',' 或 ';' 在 /httpdocs/cron123/purge.php 第 4 行
这是代码:
<?
ob_start();
global $siteRoot = '/httpdocs/';
global $reportRoot = '/reports/';
include('billing1.php');
$date='Purge report for: ' .date('M d, Y \a\t g:i a'); ?>
<html>
<head><title><?=$date?></title></head>
<body>
<?php
$account = new billing();
$ftresult = $account->purge();
new dBug($ftresult);
echo "successfully wrote";
?>
</body>
<?
$filename = "purge_report_" . date('y.m.d_\a\t_g_i_a') . ".html";
$loc = $reportRoot . 'purge_reports/';
$f = $loc . $filename;
$fp = @fopen($f, 'w');
@fwrite($fp, ob_get_contents());
@fclose($fp);
ob_end_flush();
?>