|
我在model中写了一个文件名为company.php如下:
<?php
class Company extends CI_Model
{
function __construct()
{
parent::__construct();
$this->load->database();
}
function company_insert($arr){
$this->db->insert(company', $arr);
}
}
?>
在controllers下写的文件如下 :
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Company extends CI_Controller {
function insert()
{
$na=array("c_name"=>"tom01","c_Describe"=>"qingna01","temp1"=>"");
$this->load->model('company');
$this->company->company_insert($na);
}}
?>
总是不能通过;
而单独在controllers文件夹下写文件company.php:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Company extends CI_Controller {
function insert()
{
$this->load->database();
$na=array("c_name"=>"tom01","c_Describe"=>"qingna01","temp1"=>"");
$this->db->insert(company', $na);
}
能通过!
请教高手,指点一下!在下感激不尽!!!!
|
|