2016-09-22 27 views
2

Codeigniter在任何方法中添加注释后显示空白页面。例如在控制器索引方法中添加//redirect('home');。 同样的错误报告无法从index.php文件Codeigniter - 在任何控制器的任何方法中添加注释后显示空白屏幕

启用,但启用日志错误后,我在的error_log文件

PHP Parse error: syntax error, unexpected 'endif' (T_ENDIF) in /home/username/public_html/project/application/controllers/Home.php on line 1 

这里得到这个错误是我的控制器

<?php defined('BASEPATH') OR exit('No direct script access allowed'); 

    class Home extends CI_Controller { 

     public function index(){ 
      echo 'Home Page'; 
      //redirect('home'); 
     } 
     public function test(){ 
      echo 'Test'; 
     } 


    } 
+0

我认为有语法错误请检查您的代码。 –

+0

删除该评论后,每件事情都起作用。 – shah

+0

不错,但错误的是你的代码是正确的请放置注释并再次检查 –

回答

0

花费了几个小时和几小时后,我fi确定我的FTP客户端出现了一些错误(FileZilla)。

上传文件通过FileZilla它将所有代码转换为一行,如果有任何意见,然后显示错误。

-2

更改第一行:

<?php 
    if (!defined('BASEPATH')) 
     exit('No direct script access allowed');