由於某種原因,調用header()會導致我發生內部服務器錯誤。我正在使用PHP5並在此腳本中廣泛使用mod_rewrite(如果有幫助的話)。這裏是(在某種程度上)代碼:PHP header()導致內部服務器錯誤
<?php
include 'core/initialize.php'; // Loads the core class (and session manager class)
if($_GET['reset'] == 'true')
{
$core->Session->Visits = 0;
header('Location', 'index.html');
# header('X-Test', 'wtf'); // causes the error too :(
}
if(isset($core->Session->Visits)) $core->Session->Vists += 1;
else $core->Session->Visits = 0;
echo "Previous Visits: {$core->Session->Visits} (<a href='index.html?reset=true'>Reset</a>)";
?>
我的.htaccess文件看起來是這樣的:
# Start up the rewrite engine
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ navigator.php?nav=$1&%{QUERY_STRING} [NC]
現在我覺得很蠢。謝謝 – 2009-07-31 23:14:30