2016-08-08 4 views
0

見つからない括弧は検索されていますが、表示されません。私は数年間コードを見ていない。また、オンラインのPHPチェッカーをいくつか使用しましたが、間違ったものは見当たりませんでした。

私が試してindex.phpにアクセスすると、httpdエラーログに次のエラーが表示されます。ファイルmodule.phpはインデックスファイルに含まれています。以下はmodule.phpファイルです。

PHP Parse error: syntax error, unexpected $end in /var/www/html/utm5_web_php/lib/module.php on line 155

また、私は本当にPHPプログラマではないよ、私はその何かが、我々が使用できるかどうかを確認するために動作するようにテストプログラムを入手しようとしています。

<?php // as open tag 

?> // as close tag 

をも念頭に置いて間隔を保つ -

<?php 

include_once dirname(__FILE__)."/../lib/table.php"; 
include_once dirname(__FILE__)."/../lib/form.php"; 
include_once dirname(__FILE__)."/../lib/lang.php"; 
include_once dirname(__FILE__)."/../lib/resolve.php"; 

class Module { 
    private $title; 
    private $group; 
    private $visible; 
    private $login; 
    private $menu; 
    private $errorMessage; 
    private $printMode = false; 
    private $invoiceMode = false; 
    protected $urfa; 

    function init($title='Unknown',$group='Default',$visible = false,$login = false) { 
     $this->title = str_replace(' ', '&nbsp;', $title); 
     $this->group = $group; 
     $this->visible = $visible; 
     $this->login = $login; 
    } 

    function writeBody() { 
    } 

    function setPrintMode($mode){ 
     $this->printMode=$mode; 
    } 

    function setInvoiceMode($mode){ 
     $this->invoiceMode=$mode; 
    } 

    function loadMenu() { 
     global $MOD_TITLE,$MOD_GROUP,$MOD_VISIBLE; 
     $this->menu = array(); 
     $dir = dir(dirname(__FILE__)."/../modules"); 

     $fileArray = array(); 

     while(false !== ($file = $dir->read())) { 
      $fileArray[] = $file; 
     } 
     sort($fileArray); 
     foreach ($fileArray as $file) { 
      if(preg_match("/^([a-z0-9_]+)\.php$/",$file,$out)) { 
       include dirname(__FILE__)."/../modules/".$file; 
       if(!$MOD_VISIBLE) 
        continue; 

       if($MOD_LOGIN != $this->login) 
        continue; 

       if($MOD_LOGIN != true && isset($_COOKIE['system']) && $_COOKIE['system'] > 0) 
        if($MOD_SYSTEM != $_COOKIE['system']) 
         continue; 


       $this->menu[$MOD_GROUP][$out[1]] = $MOD_TITLE; 
      } 
     } 
    } 

    function writeHtml() { 
     global $CONF_PATH; 
     global $CONF_LANG; 
     $this->loadMenu(); 
     if($this->invoiceMode == false){ 
?> 
     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
     <html> 
      <head> 
       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 

       <!-- main UTM5 web stylesheet --> 
       <link rel="stylesheet" type="text/css" href="<?=$CONF_PATH?>utm.css"> 

       <!-- calendar-specific scripts --> 
       <link rel="stylesheet" type="text/css" href="<?=$CONF_PATH?>lib/jscalendar/calendar-blue.css"> 
       <script type="text/javascript" src="<?=$CONF_PATH?>lib/jscalendar/calendar.js"></script> 
       <script type="text/javascript" src="<?=$CONF_PATH?>lib/jscalendar/lang/calendar-<?=$CONF_LANG?>-UTF.js"></script> 
       <script type="text/javascript" src="<?=$CONF_PATH?>lib/jscalendar/calendar-setup.js"></script> 
       <script type="text/javascript" src="<?=$CONF_PATH?>lib/filter/filterlist.js"></script> 
       <script type="text/javascript" src="<?=$CONF_PATH?>lib/js/jquery-1.9.1.min.js"></script> 


       <title>UTM: <?=langGet($this->title)?></title> 
      </head> 
      <body class="body"> 
<?   if($this->printMode == false){?> 
       <table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0"> 
        <tr> 
         <td class="menu-area"> 
<? 
         foreach($this->menu as $group => $items) { 
          if($group == $this->group) 
           echo "<div class='mainmenu-act'>".langGet($group)."</div>\n"; 
          else { 
           $module = key($items); 
           echo "<div class='mainmenu-inact'><a href='".$CONF_PATH."?module=".$module."'>".langGet($group)."</a></div>\n"; 
          } 
         } 
?> 
         </td> 
         <td class="work-area"> 
          <table width="100%"><tr><td class="submenu-area"> 
<? 
         foreach($this->menu[$this->group] as $module => $title){ 
          $title_lang = str_replace(' ', '&nbsp;', langGet($title)); 
          if($title == $this->title) 
           echo "<span class='submenu-act'>".$title_lang."</span>\n"; 
          else 
           echo "<span class='submenu-inact'><a href='".$CONF_PATH."?module=".$module."'>".$title_lang."</a></span>\n"; 
         } 
?> 
          </td></tr></table> 
<? 
         global $MOD_SUBMENU; 
         if($MOD_SUBMENU != true){ 
          echo('<br>'); 
         } 

          if($this->errorMessage) { 
           echo "<p style='color:red'>".$this->errorMessage."</p>\n"; 
          } 
          $this->writeBody(); 
?> 
         </td> 
        </tr> 
       </table> 
<?   } else { 
       $this->writeBody(); 
      } ?> 
      </body> 
     </html> 
<? } else { 
      header("Content-Type: text/html; charset=utf-8"); 
      $this->writeBody(); 
     } 
    } 

    function setUrfa($urfa) { 
     $this->urfa = $urfa; 
    } 

    function addErrorMessage($msg) { 
     $this->errorMessage = $msg; 
    } 
} 

?> 
+0

に設定を変更する必要があります。 –

+0

短いタグが有効になっていますか?あなたがここに含まれているファイルをインクルードすると、ライン155とは何ですか? – chris85

答えて

0

代わりにあなたが使用することができ、<? ?>タグの使用を避けることができます。以下のような<php { //} ?>

は短いオープンタグを有効にするために、あなたはあなたがが、その前のラインそれはおそらくライン上で不足しているセミコロンだ155は表示されませんphp.iniの

`short_open_tag = Off` // in php.ini turn to On 
+0

あなたの回答を将来的にフォーマットして、意図通りに読むようにしてください。 – chris85

+0

ありがとう@ Chris85。 –

+0

ありがとう、ありがとう、私はに変更し、スペースをチェックして、ファイルmodule.phpにそれ以上のエラーはありません。私はまた、php.iniファイルをチェックし、それはshort_open_tag =デフォルトではオンですが、私は変更しただけでその行をコメントアウトしました。 –

関連する問題