为什么代码Igniter给我一个白页? [英] Why does Code Igniter give me a white page?

查看:97
本文介绍了为什么代码Igniter给我一个白页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,不知道为什么CodeIgniter在我加载一个简单的模型时给我一个空白页。我打破了代码向下,向后,我不知道什么是打破。这是控制器:

Hey, not sure why CodeIgniter is giving me a blank page when I load a simple model. I'm breaking the code down, backwards, and I can't figure out what's breaking. Here's the controller:

class Leads extends Controller {

function Leads() {
    parent::Controller();
    $this->load->scaffolding('leads');
  }

function index() {
    $data = array( 'title' => 'Lead Management' );

    $this->load->view('html_head', $data);
    $this->load->view('leads/home');
    $this->load->view('html_foot');

  }

function view() {
    $this->load->model('Leads');
    $this->load->view('html_head');
    $this->load->view('leads/view');
    $this->load->view('html_foot');
  }

}

以下是模型:

class Leads extends Model {

function Leads()    {
    parent::Model();
}

}

唯一的方法,我没有得到一个白色的页面/视图是如果我注释掉模型的加载。我完全不知道我在做什么错,我复制的例子和结构直接从CI网站。

The only way I don't get a white page on /view is if I comment out the loading of the model. I have absolutely no idea what I'm doing wrong, I'm copying the examples and structure literally right off the CI site.

推荐答案

两个类都命名为Leads。当CI包括这些时,它们被加载到同一命名空间。您可能有一个无法重新声明类'Leads'错误。尝试重命名模型,你应该很好。

Both your classes are named "Leads". When CI includes these, they are loaded into the same namespace. You probably have a "Cannot redeclare class 'Leads'" error. Try renaming the model and you should be fine.

编辑:猜测已确认

guess confirmed

这篇关于为什么代码Igniter给我一个白页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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