【问题标题】:Yii redirect() converted & to & - HybridAuth GoogleYii redirect() 将 & 转换为 & - HybridAuth Google
【发布时间】:2014-03-03 04:24:40
【问题描述】:

我在我的网站上使用 HybridAuth 2.1.2 进行社交登录,通过 Yii 框架实现。

Facebook 可以正常运行。我在使用 Google 等其他登录方式时遇到了问题。

HybridAuth 将用户重定向到以下 URL:

https://accounts.google.com/o/oauth2/auth?client_id=XXXCLIENTIDXXX&redirect_uri=http%3A%2F%2Fwww.XXX.de%2Fsociallogin%3Fhauth.done%3DGoogle&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&access_type=online

如果我在 HybridAuth/hybridauth-2.1.2/Hybrid/Providers/Google.php 中回显重定向 url,我会得到这个 url:

https://accounts.google.com/o/oauth2/auth?client_id=XXXCLIENTXXX&redirect_uri=http%3A%2F%2Fwww.XXX.de%2Fsociallogin%3Fhauth.done%3DGoogle&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&access_type=online

谷歌.php:

[...]
    echo $this->api->authorizeUrl( $parameters );
    return true;
    Hybrid_Auth::redirect( $this->api->authorizeUrl( $parameters ) ); 
}

问题是我认为的 & 符号。任何想法如何抑制 redirect() 以生成加密 URL?

【问题讨论】:

  • htmlspecialchars_decode() 将变回 &到 &
  • 是的。但是 header() 函数在没有编码字符的情况下获得了正确的 url。在我当地的开发环境中,它可以工作。哪个php设置对此负责? default_charset?

标签: php yii oauth-2.0 hybridauth


【解决方案1】:

将以下行添加到 .htaccess-file 解决了问题:

php_value  arg_separator.output  &

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-12-25
    • 2014-02-10
    • 2015-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-13
    • 1970-01-01
    相关资源
    最近更新 更多