两周前我有一个工作项目上传到服务器。直到现在它还运行得很好。以下是awsmodel.php 型号的代码
class Awsmodel extends MY_Model {
function __construct()
{
}
// some other functions
}
MY_Model再次扩展到CI_Model。
class MY_Model extends CI_Model {
// required functions
}
在controllerpages.php中,我调用如下函数。
class Pages extends MY_Controller {
public function index()
{
$data = $this->allCommonMenu();
$this->load->model('Awsmodel');
$data['featured'] = $this->Awsmodel->featuredProp();
$this->load->view('home_pz',$data);
}
}
上面的代码今天突然弯下腰工作。经过一些测试和尝试,我知道当我在控制器函数的两行下面评论时,页面就会加载。
$this->load->model('Awsmodel');
$data['featured'] = $this->Awsmodel->featuredProp();
我已经将环境变量更改为"development"并进行了测试,但仍然没有显示错误消息。在firefox中,它显示一个空白页面,而在chrome中,它则显示500服务器错误。同样的代码从2周开始工作。不知道为什么现在不起作用。有人能帮我吗
我使用的是2.1.4版的CI
如果您使用CI 3.0,请加载这样的模型
class Pages extends MY_Controller {
public function index()
{
$data = $this->allCommonMenu();
$this->load->model('awsmodel'); //as your model filename: awsmodel.php
$data['featured'] = $this->Awsmodel->featuredProp();
//$data['featured'] = $this->awsmodel->featuredProp();// for CI version 2.1.4 –
$this->load->view('home_pz',$data);
}
}