해야한다 "top.location.href"다른 방법과를 찾고 싶어요. 또한, 등호가 필요합니다. (감사 David Barker)
$app_id = APP_ID;
$canvas_page = APP_LINK;
$auth_url = "http://www.facebook.com/dialog/oauth?client_id=". $app_id . "&redirect_uri=" . urlencode($canvas_page) . "&scope=email,read_stream";
echo "<script> top.location.href='" . $auth_url . "';</script>";
다음과 같이하면 어떻게됩니까? echo "<script> alert('".$auth_url."');</script>";
?
또한
, 그리고 PHP에서이 작업을 수행하는 쉬운 방법은 다음과 같이이다 : 당신이 내 단일 및 쌍 따옴표를 사용할 수 있습니다 아무것도 탈출해야하지 않으며, 변수는 본질적으로 교체 히어 닥 구문을 사용
$app_id = APP_ID;
$canvas_page = APP_LINK;
$auth_url = "http://www.facebook.com/dialog/oauth?client_id". $app_id . "&redirect_uri=" . urlencode($canvas_page) . "&scope=email,read_stream";
echo <<<EOT
<script>
top.location.href="$auth_url";
//checking the value of auth_url to see if that is the reason redirect is not happening.
if (window.console) {
console.log("$auth_url");
} else {
alert("$auth_url");
}
</script>
EOT;
당신의 끈. ;)
URL 문자열에 = after client_id가 누락되었습니다. –