如何使用php从flash重定向页面


how to redirect a page from flash using php

Hello community我有以下场景。

我有一个带有按钮的swf,它向php文件发送URL请求。具体如下。

    <?php
      session_start();
      if(isset($_SESSION['user'])){
        header ('Location: http://mydomain.com/test/reroute.php');
        exit();
      }
   ?>

但是,php文件不会重新路由到所需的页面。我是不是错过了什么?

非常感谢,

要从flash转到页面,您需要执行以下navigateToURL操作:

navigateToURL(new URLRequest("http://mydomain.com/test/reroute.php"), "_self");

编辑要对重定向url进行软编码,我建议你这样做(我怀疑这与你想要的更相关)

private var loader:URLLoader=new URLLoader();
private function init():void {
    //In the class initialize handler
    loader.addEventListener(Event.COMPLETE, redirectReceived);
}
private function redirectReceived(e:Event):void {
    if(StringUtil.trim(e.target.data).length > 0) {
        navigateToURL(new URLRequest(e.target.data), "_self");
    }
}
private function buttonClick(e:MouseEvent):void {
    loader.load(new URLRequest("http://path_to_the_php_which_tells_you_where_to_redirect"));
}

而php,告诉你重定向到哪里将是这样的:

<?php
      session_start();
      if(isset($_SESSION['user'])){
        echo('Location: http://mydomain.com/test/reroute.php');
      }
?>