我在调试代码时遇到问题。我正在按照教程构建日历应用程序。但每次我尝试运行它时都会显示上述错误。因此,我需要帮助来发现错误。
以下是代码行:
public function displayEvent($id)
{
/*
*Make sure an ID was passed
*/
if ( empty($id) ) { return NULL; }
/*
*Make sure an ID is an integer
*/
$id = preg_replace('/[^0-9]/', '', $id);
/*
*Load the event data from the DB
*/
$event = $this->_loadEventById($id);
/*
*Generate strings for the date, start, and end time
*/
$ts = strtotime($event->start);
$date = date('F d, Y' $ts);
$start = date('g:ia', $ts);
$end = date('g:ia', strtotime($event->end));
/*
*Generate and return the markup
*/
return "<h2>$event->title</h2>"
. "\n\t<p class=\"dates\">$date, $start—$end</p>"
. "\n\t<p>$event->description</p>";
}
代码要长得多,但为了简洁起见,不必为任何使用长代码的人负担,我只复制了错误来自的函数。
出了什么问题?
答案 0 :(得分:3)
在变量之前加上8 / 0.434 = 18.42
。
,