Tho*_*son 3 php redirect codeigniter
Codeigniter不会oauth://application正确地重定向"url" ,将其固定在当前域之后,如下所示:
http://mywebsite.com/index.php/oauth://application
Run Code Online (Sandbox Code Playgroud)
代码如下所示:
redirect("oauth://application", "location"); // changing to refresh doens't work either.
Run Code Online (Sandbox Code Playgroud)
知道如何让这个工作吗?我正在尝试重定向到Android应用.
非常感谢.
不妨使用PHP的原生header函数:
header('Location: oauth://application', TRUE, 302);
exit;
Run Code Online (Sandbox Code Playgroud)
如果要调整CI的功能,只需创建application/helpers/my_url_helper.php并调整preg_matchURL检查:
function redirect($uri = '', $method = 'location', $http_response_code = 302)
{
// if ( ! preg_match('#^https?://#i', $uri))
if ( ! preg_match('#^(https?|oauth)://#i', $uri))
{
$uri = site_url($uri);
}
switch($method)
{
case 'refresh' : header("Refresh:0;url=".$uri);
break;
default : header("Location: ".$uri, TRUE, $http_response_code);
break;
}
exit;
}
Run Code Online (Sandbox Code Playgroud)