非常新的Codeingiter,並試圖執行本教程http://www.grocerycrud.com/documentation/create-crud-codeigniter-tutorial後的Grocery CRUD。
在下面的代碼這樣做(順便說一下,我自動加載數據庫庫和url幫手)。
<?php
class Management extends CI_Controller {
public function construct()
{
parent::__construct();
$this->load->library('grocery_CRUD');
}
public function index()
{
echo "<h1>Just work!</h1>";
die();
}
public function property()
{
$this->grocery_crud->set_table('property');
$output = $this->grocery_crud->render();
echo "<pre>";
print_r($output);
echo "</pre>";
die();
}
/**
public function view($page = 'management_page')
{
if (! file_exists('application/views/pages/'.$page.'.php'))
{
// Whoops, we don't have a page for that!
show_404();
}
$data['title'] = ucfirst($page); // Capitalize the first letter
$this->load->view('templates/header', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);
}
**/
}
然而,當我打開這個網頁[BASE] /管理/屬性我得到以下錯誤:
Severity: Notice
Message: Undefined property: Management::$grocery_crud
Filename: controllers/management.php
Line Number: 21
誰能幫助?
嘗試具有庫加載名稱全部小寫。 – isawhat
沒有好,我很害怕,但感謝 – gazrolo4