编码帮助(HTTP错误500)

时间:2013-03-28 13:53:25

标签: php html

所以,假设我有这个code.txt文件:

<html>
<head>
<title><?php echo $title; ?></title>
</head>
<body>
<?php echo $content; ?>
</body
<html>

每当我想添加页面时,我只需创建一个名为page.php的文件:

<?php
$title="page title";
$content="Page content coded in html";

require 'code.txt';
?>

每当我在$ content字符串上添加超链接等HTML元素时,page.php文件就会在浏览器上返回HTTP Error 500。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:5)

不要为PHP / HTML使用.txt文件扩展名。使用扩展程序PHP将识别为.php.inc