注销按钮重定向php

时间:2015-10-22 07:13:31

标签: php json logout

我在html中有这个注销按钮,

 <a href="<?php echo PSF::urlFor('logout');?>" class="link" id="position">Logout</a></li>

它进入PSF类并搜索注销功能,并注销用户。 它工作正常。

现在我想尝试在弹出窗口中执行相同操作,通过,

return json_encode (
    array(
        'errors' => array(
             'Sorry you are already logged in, please Logout from other Devices or click to"<a href="echo PSF::urlFor('logout');" class="link" id="position">Logout</a>"'
        )
    )
);

这个json被发送到,

if (d.errors) {
    $("#load-overlay-elt").isLoading("hide");
    $('#login_wait').button('reset');
    a.empty();
    var msg='';
    $.each(d.errors, function(i, n){
        //a.append(n + '<br/>');
        msg += n + ', ';
    });
    $.auctions.alert(msg);
    a.show();
}

邮件已打印,但注销按钮似乎无法正常工作,我错过了什么?

1 个答案:

答案 0 :(得分:1)

您应该更改

return json_encode (array('errors' => array( 'Sorry you are already logged in, please Logout from other Devices or click to"<a href="echo PSF::urlFor('logout');" class="link" id="position">Logout</a>"')));

return json_encode (array('errors' => array( 'Sorry you are already logged in, please Logout from other Devices or click to <a href="' . PSF::urlFor('logout') . '" class="link" id="position">Logout</a>"')));

因为它在语法上是不正确的。