【发布时间】:2015-11-15 15:13:17
【问题描述】:
我在 Win 7 机器上的 XAMPP 开发了我的网站,它在 localhost 上运行完美。当我将它上传到实时服务器(linux)时。它开始向我显示此错误:
Fatal error: Class 'Frontend_Controller' not found in /home/acephm3/public_html/phenomesoft.com/application/controllers/Home.php on line 3
我已经检查并应用了所有我可以从谷歌获得的东西,但完全没有运气。
我使用的是 CI 3.0.3 版。
我已经设置$config['subclass_prefix'] = 'MY_';
在/application/core中创建My_Controller.php如下:
class My_Controller extends CI_Controller {
public function __construct() {
parent::__construct();
// Your own constructor code
}
public function send_mail($from, $from_name, $to, $subject, $message, $smtp, $debug) {
$this->load->library('email');
if (!$smtp) {
$this->email->from($from, $from_name);
$this->email->to($to);
$this->email->subject($subject);
$this->email->message($message);
if ( $this->email->send() ) {
$this->session->set_flashdata('message', 'We\'ve received your message. Thank you for contacting us.');
redirect('contact_us');
} else {
if ($debug) {
echo $this->email->print_debugger();
}
return false;
}
}
}
}
包括:
include_once('Frontend_Controller.php');
在/application/core/ 中创建Frontend_Controller.php 如下:
class Frontend_Controller extends My_Controller {
public $data;
public function __construct()
{
parent::__construct();
// Your own constructor code
$this->data = array();
}
public function _load_template($tpl, $data)
{
$this->load->view('frontend/includes/header', $data);
$this->load->view('frontend/'.$tpl, $data);
$this->load->view('frontend/includes/footer', $data);
}
}
在apllication/controllers/下创建了一个控制器Home.php:
class Home extends Frontend_Controller {
public function __construct() {
parent::__construct();
// Your own constructor code
}
public function index(){
$this->_load_template('home', $this->data);
}
}
在 routes.php 中设置$route['default_controller'] = 'home';。
我还需要做什么?请再次注意,我在 localhost 上没有问题。
【问题讨论】:
-
希望这个链接有帮助:stackoverflow.com/questions/4845806/…
-
不,这不是我的情况。感谢您的帮助。
标签: php codeigniter