另一个 PHP 包含问题
Another PHP include issue
我浏览了档案并阅读了一堆关于为什么 PHP include 不起作用的问题。我已尝试使用其他问题的答案来解决我的问题,但仍有问题。
这是我的代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Fuel Status Map</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="main">
<div id="map">
<?
require 'MapLink.php';
?></div>
<div id="title"><img src="title.png" width="400" height="200" />
</div>
<div id="links">
<a href="statusbyzone.php"><img src="FuelStatusLink.png" width="400" /></a>
<br />
<a href="selectoffice.php"><img src="NWSofficeLink.png" width="400" /></a>
<br />
<a href="Login1.php"><img src="FuelSpecialistLink.png" width="400" /></a>
<br />
<img src="AdminLink.png" width="400" />
<br />
</div>
<div id="legend"><img src="Legend1.png" width="400">
</div>
<div id="logos">
<img src="PSlogo.png" width="140" height="150" />
<img src="GBlogo.png" width="250" height="150"/>
</div>
</div>
</body>
</html>
页面应该如下所示:http://www.directdocuments.com/GACC/GBSite/predictive/FuelStatus/FuelStatusMap.php
但看起来像这样:http://gacc.nifc.gov/gbcc/predictive/FuelStatus/FuelStatusMap.php
MapLink.php 在同一目录中,并且工作正常。我也会 post link,但我不能再 post links.
您的 PHP 配置中似乎没有启用短开放标签,因此 require
行按字面意义输出(使用 View Source
可以看到这一点)。使用完整标签。
<?php
require 'MapLink.php';
?>
PHP also allows for short open tag <?
(which is discouraged since it is only available if enabled using the short_open_tag
php.ini configuration file directive, or if PHP was configured with the --enable-short-tags
option).
另见 Are PHP short tags acceptable to use?
我浏览了档案并阅读了一堆关于为什么 PHP include 不起作用的问题。我已尝试使用其他问题的答案来解决我的问题,但仍有问题。
这是我的代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Fuel Status Map</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="main">
<div id="map">
<?
require 'MapLink.php';
?></div>
<div id="title"><img src="title.png" width="400" height="200" />
</div>
<div id="links">
<a href="statusbyzone.php"><img src="FuelStatusLink.png" width="400" /></a>
<br />
<a href="selectoffice.php"><img src="NWSofficeLink.png" width="400" /></a>
<br />
<a href="Login1.php"><img src="FuelSpecialistLink.png" width="400" /></a>
<br />
<img src="AdminLink.png" width="400" />
<br />
</div>
<div id="legend"><img src="Legend1.png" width="400">
</div>
<div id="logos">
<img src="PSlogo.png" width="140" height="150" />
<img src="GBlogo.png" width="250" height="150"/>
</div>
</div>
</body>
</html>
页面应该如下所示:http://www.directdocuments.com/GACC/GBSite/predictive/FuelStatus/FuelStatusMap.php 但看起来像这样:http://gacc.nifc.gov/gbcc/predictive/FuelStatus/FuelStatusMap.php MapLink.php 在同一目录中,并且工作正常。我也会 post link,但我不能再 post links.
您的 PHP 配置中似乎没有启用短开放标签,因此 require
行按字面意义输出(使用 View Source
可以看到这一点)。使用完整标签。
<?php
require 'MapLink.php';
?>
PHP also allows for short open tag
<?
(which is discouraged since it is only available if enabled using theshort_open_tag
php.ini configuration file directive, or if PHP was configured with the--enable-short-tags
option).
另见 Are PHP short tags acceptable to use?