2015-04-21 51 views
0
意外的文件結尾

我得到一個錯誤:解析錯誤:語法錯誤,在PHP

Parse error: syntax error, unexpected end of file in ...\system\core\Loader.php(829) : eval()'d code on line 307..

這是loader.php

foreach ($this->_ci_model_paths as $mod_path) 
     { 
      if (! file_exists($mod_path.'models/'.$path.$model.'.php')) 
      { 
       continue; 
      } 

      if ($db_conn !== FALSE AND ! class_exists('CI_DB')) 
      { 
       if ($db_conn === TRUE) 
       { 
        $db_conn = ''; 
       } 

       $CI->load->database($db_conn, FALSE, TRUE); 
      } 

      if (! class_exists('CI_Model')) 
      { 
       load_class('Model', 'core'); 
      } 

      require_once($mod_path.'models/'.$path.$model.'.php'); 

      $model = ucfirst($model); 

      $CI->$name = new $model(); 

      $this->_ci_models[] = $name; 
      return; 
     } // this line number 307 

和eval代碼

if ((bool) @ini_get('short_open_tag') === FALSE AND config_item('rewrite_short_tags') == TRUE) 
     { 
      echo eval('?>'.preg_replace("/;*\s*\?>/", "; ?>", str_replace('<?=', '<?php echo ', file_get_contents($_ci_path))));//this is line number 829 
     } 
     else 
     { 
      include($_ci_path); 
     } 
代碼

我試過尋找這個,但找不到任何東西。

+0

這是codeigniter的核心加載文件。錯誤已經指向這個頁面,但它實際上在你的php代碼中。檢查你的代碼,尤其是你的模型被調用或調用的地方。 –

回答

1

這將由您寫入的文件引起。

看起來你可能會加載一個缺少{或}或某種語法錯誤的模型。所以你需要確定你正在加載的模型。

你可以通過URL做到這一點,看看你正在調用什麼控制器/方法。檢查控制器構造函數以查看是否在那裏加載任何模型...檢查方法並檢查自動加載器。

然後檢查那些模型 - 你寫的 - 並尋找錯誤。如果您使用的是像樣的編輯器或IDE,則應該看到它們發生的位置。