CodeIgniter不加载页面 [英] CodeIgniter not loading pages

查看:116
本文介绍了CodeIgniter不加载页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个web应用程序使用codeigniter开发,它的工作正常在我以前的服务器,现在我改变了我的服务器,当我试图运行Web应用程序只有一个空白屏幕。

I have a web application developed using codeigniter and it worked fine in my previous server now I changed my server and when I am trying to run the web application there is nothing but a blank screen.

当我尝试打开现有链接时 http://mydomain.com/MyProject1/
它是一个有效的链接,但它显示一个空白页。

When I am trying to open the existing link http://mydomain.com/MyProject1/ It's a valid link but its showing me a blank page.

当我试图打开另一个现有的链接mydomain.com/MyProject1/login/
这也是一个有效的链接,但它只显示一个空白页。

When I am trying to open another existing link mydomain.com/MyProject1/login/ This too a valid link but its displaying just a blank page.

只是为一个测试,我尝试了一些错误的链接 http://mydomain.com/MyProject1/test
显示404错误。

Just for a test I tried some wrong link http://mydomain.com/MyProject1/test It's showing 404 error.

所以,一定是代码运行正常,但页面不显示。

So, must be the code is running fine but pages are not being displayed. It's only showing blank page.

如何解决此问题?

推荐答案

确定,在index.php(它在根中)显示错误,并将此条件更改为:

Ok, turn displaying error in index.php (it's in the root) and change this if condition to something like:

if (defined('ENVIRONMENT'))
{
    switch (ENVIRONMENT)
    {
        case 'development':
            error_reporting(E_ALL ^ E_NOTICE);
        break;

        case 'testing':
        case 'production':
            // error_reporting(0);
            error_reporting(E_ALL ^ E_NOTICE);
        break;

        default:
            exit('The application environment is not set correctly.');
    }
}

然后出现错误。

Btw。尝试设置正确的htaccess路径到您的应用程序,如果你使用它。如果在您的localhost它是:

Btw. try to set the correct htaccess path to your app if you are using it e.g. if on your localhost it was:

RewriteEngine On

RewriteBase /projects/mywebsite/

在服务器上将其更改为:

change it on server to:

RewriteEngine On

RewriteBase /

不使用子域等。

Btw。如果您遇到类似于已发送的标头的错误,您需要将文件另存为无BOM的utf-8,而不是utf-8 。或者,文件开头可能有一些字符,您需要在文本编辑器中将其删除。

Btw. if you get an error like headers already sent or something like that, you will need to save your files as "utf-8 without BOM" instead just "utf-8". Or there might be some characters on the beginning of the file, which you need to delete in your text editor.

检查您正在使用的文件,例如语言文件,视图,控制器等,并检查它们是如何编码的。如果他们是utf-8更改编码为utf-8没有BOM。它可以在几乎每个文本编辑器,如记事本++或Sublime。然后将这些文件重新上传到您的服务器。

Check the files you are working with e.g. language files, views, controllers etc. and check them how are they encoded. If they are utf-8 change encoding to utf-8 without BOM. It can be done in almost every text editor like Notepad++ or Sublime. Then reupload these files to your server.

这篇关于CodeIgniter不加载页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆