求助!controller中无法调用model中的方法
求助,controller中无法调入model中的方法controller中的饿代码如下:
class Bem extends Controller {
function __construct() {
parent::__construct();
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->load->library('tank_auth');
$this->load->model('bes');
$this->lang->load('tank_auth');
}
}
model中自己写了一个bes.php文件
代码如下:
class Bes extends Model {
function Bes() {
parent::Model();
}
function gethosts() {
$this->db->order_by('HOSTID', 'asc');
return $this->db->get('TBLHOST');
}
}
不知道为什么不能调用
之前的环境是 php5.1.6 + mysql5.0.xx + CI 1.7.2,一切正常
现在变成了php 5.3.2 + mysql 5.1.xx + CI 1.7.2,就出现这种问题了
请问版本的差异在哪里? parent::__construct();
这句错了,应该是
parent::Controller(); parent::__construct();
这句错了,应该是
parent::Controller();
Hex 发表于 2011-1-18 16:34 http://codeigniter.org.cn/forums/images/common/back.gif
I have changed it already, but it still doesn't work... 没看到哪调这个方法:
gethosts 没看到哪调这个方法:
gethosts
bluelomo 发表于 2011-1-19 16:42 http://codeigniter.org.cn/forums/images/common/back.gif
yep, Because I didn't copy the whole code~
but the problem 's solved already~
There are servial differences between PHP 5.3 and before~
Some grammer is currect in PHP 5.2 and before, but in PHP 5.3
Thanks for the replying ~ $this->bes_model->gethosts();
真是个奇怪的问题!
页:
[1]