[英]CodeIgniter Controller displays blank page when calling parent constructor
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Home extends MY_Controller {
public function __construct(){
parent::__construct();
}
}
The code stops executing after calling the parent constructor, without giving absolutely any error messages. 该代码在调用父构造函数后停止执行,而没有给出任何错误消息。 If I echo something before constructor call, it is echoed.If i remove the database from auto load library it will display error message .I have configured correct database details on the database file.Any one please help me?
如果我在构造函数调用之前回显某些内容,则会回显它。如果我从自动加载库中删除数据库,它将显示错误消息。我在数据库文件上配置了正确的数据库详细信息。有人可以帮助我吗?
The Question has very few information, anyway I will post this answer so that you can debug your program. 该问题的信息很少,无论如何,我都会发布此答案,以便您可以调试程序。 If you can give more information I can edit the answer as well.
如果您可以提供更多信息,我也可以编辑答案。
It sounds like you may have a problem in the MY_Controller
, to make sure that replace you Home Controller with the following code. 听起来您的
MY_Controller
可能有问题,请确保使用以下代码替换Home Controller。
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller {
public function index(){
echo "hey I am working";
}
}
If this works, we can come to the conclusion that your MY_Controller
has an error. 如果这
MY_Controller
,我们可以得出结论,您的MY_Controller
有错误。 In that case we need to see the MY_Controller
to help further. 在这种情况下,我们需要查看
MY_Controller
进一步提供帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.