国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

webman框架關(guān)于header函數(shù)的使用

phpfuns

問題描述

public function redirectToCas($gateway=false,$renew=false)
{
phpCAS::traceBegin();
$cas_url = $this->getServerLoginURL($gateway, $renew);
session_write_close();
if (php_sapi_name() === 'cli') {
@header('Location: '.$cas_url);
} else {
header('Location: '.$cas_url);
}
phpCAS::trace("Redirect to : ".$cas_url);
$lang = $this->getLangObj();
$this->printHTMLHeader($lang->getAuthenticationWanted());
$this->printf('<p>'. $lang->getShouldHaveBeenRedirected(). '</p>', $cas_url);
$this->printHTMLFooter();
phpCAS::traceExit();
throw new CAS_GracefullTerminationException();
}

為此你搜索到了哪些方案及不適用的原因

項目需要實現(xiàn)單點登錄,用的是apereo/phpcas這個包,但是執(zhí)行到跳轉(zhuǎn)到cas服務(wù)器的時候,header執(zhí)行不了,也就是上面這個
if (php_sapi_name() === 'cli') {
@header('Location: '.$cas_url);
} else {
header('Location: '.$cas_url);
}
位置,其中webman是cli模式。
有好的解決方案么?
搜了下,header在cli模式下不可用。

1524 1 0
1個回答

qq7467466

仔細看下文檔 http://wtbis.cn/doc/webman/response.html

function redirect($location, $status = 302, $headers = [])
{
    $response = new Response($status, ['Location' => $location]);
    if (!empty($headers)) {
        $response->withHeaders($headers);
    }
    return $response;
}
  • 暫無評論
年代過于久遠,無法發(fā)表回答
??