flash无法连接本地服务器上的PHP脚本

作者Kuma 文章分类 分类:About Codes 文章评论 1条评论 阅读次数 已被围观 2342

                今天开始来看《Flash And PHP Bible》一书。在跟着上做到时候发现一个奇怪的问题,Flash找不到我本地的PHP脚本文件……

        示例如下:

        Flash:

        var phpFile:String ="http://localhost/callLink.php";
        function callServer():void
        {
            var urlRequest:URLRequest = new URLRequest(phpFile);
            var loader:URLLoader = new URLLoader();
            loader.load(urlRequest)
            loader.addEventListener(Event.COMPLETE, serverResponse);
            loader.load(urlRequest);
         }

        function serverResponse(e:Event):void
        {
            var loader:URLLoader = URLLoader(e.target);
            var variables:URLVariables = new URLVariables(loader.data);
            timeTxt.text = variables.returnName;
            trace(variables.returnValue)
        }
        callServer();

        当运行Flash时会报错:

            打开 URL 'http://localhost/callLink.php' 时出错
            Error #2044: 未处理的 ioError:。 text=Error #2032: 流错误。 URL: http://localhost/callLink.php

        我挺纳闷的,这个错误很莫名其妙,因为我如果直接在浏览器里面输入http://localhost/callLink.php时是能够打开这个页面的,但是Flash去找不到。然后我将这个文件上传服务器,将地址改为:http://mouselife.cn/callLink.php后运行,正确执行。然后我又在本地建立一个callLink.asp文件,将Flash里面的地址改为http://localhost/callLink.asp,也正确执行。也就是说Flash唯独检测不到我本地服务器上的PHP脚本文件。

        本人疑惑中,期待高手解答……

分类:About Codes
标签: Flash php

通告: http://mouselife.net/tb.php?sc=e2fe83&id=58

评论:

  1. [回复]PNG图标发表于 2010-03-14 17:10
    我也遇见这事了,正头疼呢。
    • [回复]Kuma发表于 2010-03-14 18:12
      @PNG图标:后来我发现时本机PHP服务器的问题。我以前是配置的PHP+IIS的,后台重装了就行。建议你重装PHP服务器,或者直接用WAMP安装包试试

发表评论: