这是我们目前正在进行网站设计/迁移(MAJOR HEADACHES)的交易,从直接的PHP/HTML网站到基于Drupal的网站。我们有我们的家庭人员(也就是我)在做事情,然后我们有设计人员,他们也有第三方做事情。几个星期前,我用我们旧网站的一些代码创建了一个view - 查看drupal,它扫描一个目录并列出目录中关于我们工作人员报告的所有内容。自那以后我没有碰过它,并且它一直工作得很好,因为其他6页以同样的方式完成。周四下午,该页面突然停止工作,只会呈现空白页面。我没有触及它,并且尽可能接近我所知道的其他人。我将它与其他页面进行了比较,但我看不到任何错误。我错过了什么吗?或者这是一个Drupal问题?PHP突然停止工作?
<?php
$PHP_SELF = '/' . current_path();
$base = DRUPAL_ROOT . "/staff-reports";
$thisyear = date("Y");
# Strip out any HTML tags to eliminate cross-site scripting.
foreach ($_GET as $value) {
$value = preg_replace("/<(.*?)>/","",$value);
}
# Then grab each GET value into a variable.
foreach ($_GET as $varname => $value) {
$$varname = $value;
}
# If a year was not specified, use the current year by default.
if (!$year) {
$year = $thisyear;
}
# List the year folders in the base directory (2001, 2002, et cetera).
if ($handle = opendir($base)) {
while (false !== ($file = readdir($handle))) {
// echo $file . '<br />';
if(is_dir($base . '/' . $file)){
// echo $file . 'Is a directory <br />';
if (preg_match("/\d\d\d\d/",$file)) {
$years[count($years)] = $file;
}
}
}
closedir($handle);
rsort($years);
}
# List the target year directory.
$reports = array();
$directory = $base . '/' . $year;
if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
if (preg_match("/staff-report-\d\d\d\d-\d\d-\d\d\..../",$file)) {
$reports[count($reports)] = $file;
}
}
closedir($handle);
if (count($reports)) {
sort($reports);
}
}
print "<table cellpadding=\"5\" border=\"1\" summary=\"Meetings\"><tr valign=\"top\">";
# Print the year index in the first column.
print "<td align=\"center\"><p><span class=\"bold\">Year index</span></p>\n";
for ($i = 0; $i < count($years); $i++) {
if ($years[$i] == $year) {
print "<b>";
}
print "<a href=\"$PHP_SELF?year=$years[$i]\">$years[$i]</a><br />\n";
if ($years[$i] == $year) {
print "</b>";
}
}
print "</td>";
# Print the list of issues for the specified year in the other column.
print "<td align=\"center\"><p><span class=\"bold\">$year reports</span></p>\n";
if (count($reports)) {
# print count($reports) . " issues<p>";
for ($i = 0; $i < count($reports); $i++) {
$y = substr($reports[$i],13,4);
$m = substr($reports[$i],18,2);
$d = substr($reports[$i],21,2);
# print "<a href=\"/staff-reports/$year/$reports[$i]\">$m/$d/$y</a><br />\n";
print "<a href=\"/staff-reports/$year/$reports[$i] \ "> ";
print date("F j, Y", mktime(0,0,0,$m,$d,$y));
print "</a><br />\n";
}
} else {
print "No reports";
}
print "<br />\n";
print "</td></tr></table>\n";
?>
<p>To view these documents, you need a PDF reader such as the <a
href="http://www.adobe.com/products/acrobat/readstep2.html">Adobe Reader</a>.</p>
<hr />
<?php
?>
只需在开发过程中打开错误报告,就会发现您的问题,或至少查看错误日志。 – 2014-09-02 20:10:11
当东西不起作用打开错误报告! – 2014-09-02 20:21:10
猜猜我没有真正想到在Drupal中以相同的方式工作......我会牢记这一点。 – Inky1231 2014-09-02 20:42:23