Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 条件html在尝试登录之前被激活_Php_Codeigniter - Fatal编程技术网

Php 条件html在尝试登录之前被激活

Php 条件html在尝试登录之前被激活,php,codeigniter,Php,Codeigniter,我正在使用codeigniter 2.1。我的登录视图中有以下内容: <? if($message == TRUE): ?> <div class="row"> <div class="span4"> <div class="alert alert-error"> <strong>Login</strong> failed!.

我正在使用codeigniter 2.1。我的登录视图中有以下内容:

<? if($message == TRUE): ?>
    <div class="row">
        <div class="span4">
            <div class="alert alert-error">
                <strong>Login</strong> failed!.
            </div>
        </div>
    </div>
我清除了浏览器缓存,所以我认为它不是保留的cookie

你知道怎么解决这个问题吗

提前感谢,


比尔

你可以把它做成一个类型检查<代码>$message==true。对message变量执行
var\u dump($message)
,查看它被设置为什么值。我这样做了,并且在视图中正确设置了值1)视图中是否有
?2) “首次激活登录页面”是什么意思?你是说浏览网页吗?或者是ajax还是什么?Storm drain你是对的,我工作的服务器没有使用短标记语法,因此它没有识别出这种情况,我现在更改了语法并开始工作。@JohnP抱歉,我标记了这个问题,因为答案似乎不相关,而且是如此本地化,不可能对任何其他人都有帮助。我也没有给出正确的答案;OP看到了我使用的完整标签并尝试了一下。如果问题应该留下来回答,OP应该回答,因为他们找到了解决方案。
if(!$this->is_logged_in()){
        $this->load->view('login', array('message' => FALSE));
    }
    else{
        redirect('site');