在index.php中返回FALSE或TRUE的效果

时间:2014-04-29 00:56:53

标签: php codeigniter oop

我不知道标题是否解释了我的问题,我试图找出从控制器中的index.php文件返回FALSE或TRUE的优缺点。 而且我认真地用谷歌搜索没有运气。

示例:

Class MY_MAIN_controller extends CI_Controller {
    function __construct() {
        // My constructor 
    }
    function index() {
        // example trying calling some function from another class I have in my project
        if ( ! $this->user_is_in()) {
            // Do something
            return FALSE;
        }
        // calling something else 
        if ( ! $this->user_is_active() {
            // Do something
            return FALSE;
        }
        if ($this->user_is_admin() {
            // Do something
            return FALSE; // or maybe return TRUE
        }
        $this->load->view->('home'); 
        // Then maybe return TRUE or FALSE
    }
}

现在TRUE和FALSE命令对代码的影响是什么? 这样做是不好的做法。 ?

0 个答案:

没有答案
相关问题