我想在CodeIgniter中设置我的第一个项目。我按照此页面中显示的步骤操作:http://code.tutsplus.com/tutorials/everything-you-need-to-get-started-with-codeigniter--net-2634
当试图遵循第8步时,我有一个错误。
这是我的代码:
<?php
class diploma extends Controller{
function index()
{
$this->load->model('diploma_model');
$data['result'] = $this->diploma_model->
<span class="sql">getData </span>();
$data['page_title'] = "CI Hello World App!";
$this->load->view('diploma_view',$data);
}
}
?>
我是CodeIgniter的新手。有人可以告诉我为什么会出现这个错误吗?谢谢!
编辑完这段代码后
$data['result'] = $this->diploma_model->
<span class="sql">getData </span>();
$data['result'] = $this->diploma_model->
getData ();
答案 0 :(得分:1)
错误
$data['result'] = $this->diploma_model-> # Missing here
实施例
$data['result'] = $this->diploma_model->getData();
<强> FYI 强>
这是错误的
$data['result'] = $this->diploma_model->
<span class="sql">getData </span>(); # span class cannot add to the model callback function
这应该是
$data['result'] = $this->diploma_model->getData();
修改强>
这应该是
class diploma extends Controller{
更改为
class Diploma extends CI_Controller {