是否应该在 PHP 文件的 DOCTYPE 之前放置一个包含?
我有一个包含导致配置文件的文件,我认为该文件会阻止网站加载。如果删除这包括页面加载(由于缺少功能而出现错误),但是一旦我把它放回去,它就会再次中断。
请注意。在 DOCTYPE 之前,我还有许多其他站点,它们都运行良好。它们导致的配置文件完全相同,这告诉我它不是配置文件中的编码。
所以最上面的一行现在看起来像这样:
<? include('config.php'); ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
然后配置文件如下所示:
<?
// WEBSITE SETUP
$config_website_code = "FR"; // .net IS Q, EVERYTHING ELSE IS GEO CODE
$config_db_error = 1; // IS THE DATABASE WORKING? 0 IS NO
$config_website_url = "http://www.lektronix.fr";
$config_website_short_url = "lektronix.fr";
// GOOGLE ANALYTICS
$config_analytics_code = "<script type=\"text/javascript\">\n";
$config_analytics_code .= "var _gaq = _gaq || [];\n";
$config_analytics_code .= "_gaq.push(['_setAccount', 'UA-4257220-56']);\n";
$config_analytics_code .= "_gaq.push(['_trackPageview']);\n";
$config_analytics_code .= "(function() {\n";
$config_analytics_code .= "var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n";
$config_analytics_code .= "ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n";
$config_analytics_code .= "var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n";
$config_analytics_code .= "})();\n";
$config_analytics_code .= "</script>\n";
// ASSIGN GEO BASED ON THEIR IP
include('assign_geo.php');
// ASSIGN THEIR LANGUAGE
include('assign_language.php');
// DEFINE THE CONTENT THEY SEE
include('assign_content.php');
// COMMON PAGE FUNCTIONS
include('functions.php');
// HEADER AND DESCRIPTION TAGS
include('assign_meta_data.php');
?>
这与其他工作网站相同,配置文件中包含的文件也相同。
我从头文件和索引文件中删除了所有内容,只回显“hello world”;
这已加载并且是正确的。
i then began placing code back in but the first line i placed back in was the include before the doctype and this broke the website again.