flash无法连接本地服务器上的PHP脚本
今天开始来看《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脚本文件。
本人疑惑中,期待高手解答……

分类:
已被围观 