当我试图在我的网页上发布连接日期时,我遇到了一个问题:
致命错误:在*中找不到类'getJoinDate‘
$newDate = getJoinDate::createFromFormat("l dS F Y", $dateFromDB);
$posts = PostQuery::create()->findPk(1);
echo "<p>", "ID:".$posts->getUserID().", ".$posts->getContent().", ".$posts->getJoinDate()." </p>";'请让我知道我必须做什么来显示格式。
发布于 2018-04-10 00:02:28
是这样的代码:
echo "<p>", "ID:".$posts->getUserID().", ".$posts->getContent().", ".$posts->getJoinDate()." </p>";'我不知道你的逗号应该是什么,但我猜不是实际的逗号,所以你有逗号应该停在哪里:echo "<p>", <--和行尾的撇号:</p>";'<--
您应该获得一个体面的IDE,它将立即显示这样的错误,节省大量时间。并阅读错误日志,因为它告诉您这样的错误。
使用双引号变量名将展开,请尝试如下:
echo "<p>ID: {$posts->getUserID()} {$posts->getContent()} {$posts->getJoinDate()}</p>";或者这样:
echo '<p>ID: ' . $posts->getUserID() . ' ' . $posts->getContent() . ' ' . $posts->getJoinDate() . '</p>';https://stackoverflow.com/questions/49743247
复制相似问题