PHP“意外结束”

前端之家收集整理的这篇文章主要介绍了PHP“意外结束”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我实际上检查了我的代码一百次,但我找不到错误

我得到的错误
解析错误:语法错误,意外$end在/home/tennox/public_html/PHP/kalender.PHP第46行

我试图做一个计算复活节星期日的函数,在另一个脚本中没有其他所有它只是起作用,但在这个没有.另一种方式围绕同样的事情!

<?PHP
$year = isset($_POST['year']) ? intval($_POST['year']) : date('Y');
$months = array("","Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember");
$days = array('So','Mo','Di','Mi','Do','Fr','Sa');
$ostern = getOsterSonntag($year);
?>
<form action="kalender.PHP" method="POST" target="_self">
<input type="text" name="year" value="<?PHP echo $year; ?>">
</form>
<table border="1" cellspacing="0">
<?PHP
for($y=0; $y<32; $y++) {
   echo "<tr height=\"20\">";
   for($x=1; $x<=12; $x++) {
      echo "<td width=\"5%\">";
      $date = strtotime("$y.$x.$year");
      $day = date("d",$date);
      $dayname = $days[date("w",$date)];

      if ($y == 0) {
         echo "<div align=\"center\"><b>$months[$x]</b></div>";
      } elseif ($y < date("t",$date) && !($y == 30 && $x == 2)) {
         if (date("w",$date) == 6 || date("w",$date) == 0)
            echo "<b>";
         echo "$day $dayname";
         if ($date == $ostern)
            echo "(Ostersonntag)";
         if (date("w",$date) == 0)
            echo "</b>";
      } else {
         echo "   -   ";
      }
      echo "</td>";
   }
   echo "</tr>";
}
?>
</table>

<?PHP
function getOsterSonntag($year) {
   $a = $year % 19;
   $b = $year % 4;
   $c = $year % 7;
   $k = floor($year / 100);
   $p = floor((8*$k + 13) / 25);
   $q = ($k / 4);
   $d = (19*$a + ((15 + $k - $p - $q) % 30)) % 30;
   $e = (2*$b + 4*$c + 6*$d + ((4 + $k - $q) % 7)) % 7;

   $ostern = 22 + $d + $e;
   if ($ostern > 31){
      $ostern -= 31;
      return strtotime("$ostern.4.$year");
   } else
      return strtotime("$ostern.3.$year");
}
?>
错误意味着PHP已经完成了对您的代码的分析,但是您忘记在页面的某个位置关闭符号.您忘记关闭引号,括号,括号或逗号.

希望这可以帮助.

猜你在找的PHP相关文章