【发布时间】:2012-09-07 17:21:27
【问题描述】:
此代码曾经在 PHP4 的早期版本中工作,但现在托管服务器已升级到 PHP5,因此不再在我的网站上工作。有什么简单的方法可以更改此代码以使其再次工作?
<?
if ($info == "file1") {include ("file1.html");}
if ($info == "file2") {include ("file2.html");}
if ($info == "file3") {include ("file3.html");}
if ($info == "file4") {include ("file4.html");}
if ($info == "file5") {include ("file5.html");}
?>
编辑:是的,这是我在最终网站上的代码(这里不是 PHP 专业人士)。我只是在一个简单的链接中调用“$info=_”(我想返回 www.website.com/?info=file),即:
<a href="?info=file1">Click here to read File 1</a>
【问题讨论】:
-
你得到什么错误信息?
-
那么
$info来自哪里?您不希望它通过 register_globals 来自查询字符串,是吗? (如example.com/index.php?info=file5) -
是的,$info 从何而来? PHP4 和 PHP5 之间的代码没有区别。
-
缺少
.。在您的file5中也... -
@Bgi - 没有错误,现在什么也没有显示(不包括文件)
标签: php if-statement include php4