如何修复打印代码而不是结果的PHP错误?

如何修复打印代码而不是结果的PHP错误?,php,html,Php,Html,它应该打印错误消息,但会打印: “数据['clan_id']!=0){echo“您已经有了一个氏族。”;}?>” 以下是错误的图像: 我的代码: <html> <style> .createclanbutton { background-color: green; color: black; padding: 3px; border-radius: 9px; } </style> <body> <?php if ($user->da

它应该打印错误消息,但会打印:

“数据['clan_id']!=0){echo“您已经有了一个氏族。”;}?>”

以下是错误的图像:

我的代码:

<html>
<style>
.createclanbutton {
background-color: green;
color: black;
padding: 3px;
border-radius: 9px;
}
</style>

<body>

<?php
if ($user->data['clan_id'] != 0)
{
echo "You already have a clan.";
}
?>
<br><br>
<form action="">

<h3>Create your own clan.<br><br>

Clan Name: <input type="text" name="ClanName" value="Clan Name"><br><br>

Description:<br> <textarea rows="6" cols="50">Brief description of your clan!
</textarea><br>
<button class="createclanbutton">Create your own clan!</button>
</form>

</body>
</html>

.createClan按钮{
背景颜色:绿色;
颜色:黑色;
填充:3倍;
边界半径:9px;
}


创建自己的氏族。

氏族名称:

描述:
简要描述您的氏族!
创建自己的氏族!

我正在使用phpbb,并在数据库中创建了一个名为“clan_id”的列,我将该列设置为“2”,以尝试回显错误消息。

看起来您已将该文件另存为.html或其他格式:)您需要将此文件另存为.php

您必须在已经有一个打开的PHP标记的地方包含这个。确保无论在何处包含此文件,都已关闭所有PHP标记。此文件名为什么?是的,确实如此,谢谢。在“/app.php/clan”下,但clan页面为.html