Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从flex(mxml/actionscript)运行php文件?_Php_Apache Flex_Actionscript_Mxml - Fatal编程技术网

如何从flex(mxml/actionscript)运行php文件?

如何从flex(mxml/actionscript)运行php文件?,php,apache-flex,actionscript,mxml,Php,Apache Flex,Actionscript,Mxml,如何执行flex应用程序中另一个文件中的php代码 我想要执行的php代码(很好,很简单) 因此,我希望执行上述操作。到目前为止,我的flex应用程序中有: <mx:HTTPService id="userRequest" url="C:\Users\blah\blah\blah\src\ItemTableService.php" useProxy="false" method="POST"> </mx:HTTPService> </fx:Decla

如何执行flex应用程序中另一个文件中的php代码

我想要执行的php代码(很好,很简单)


因此,我希望执行上述操作。到目前为止,我的flex应用程序中有:

 <mx:HTTPService id="userRequest" url="C:\Users\blah\blah\blah\src\ItemTableService.php" useProxy="false" method="POST">

    </mx:HTTPService>
</fx:Declarations>
<mx:Button label="Submit" click="userRequest"/>


所以我现在正在本地运行它。我认为“click-”userRequest.(somethinghere)/>上需要一些东西,但不确定它需要什么。

我使用UrlLoader类

var url:String="example";
        var urlRequest:URLRequest=new URLRequest(url);
        urlRequest.method=URLRequestMethod.POST;
    //use variables only if yu need them    
var variables : URLVariables = new URLVariables();
        variables.something=ex;
        urlRequest.data=variables;
        var urlLoader:URLLoader=new URLLoader();
        urlLoader.addEventListener(Event.COMPLETE, onComplete);
        urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onError);
        urlLoader.addEventListener(IOErrorEvent.IO_ERROR,onError);
        urlLoader.load(urlRequest);
首先在你的浏览器上试试你的php,看看你是否能得到正确的url,它应该是localhost或者类似127.0.0.1的东西

http://localhost/myscript.php

按照Josh在评论中的建议进行编辑,您必须安装并安装一台支持PHP的web服务器。

值得注意的是,PHP也需要运行服务器软件。仅在您的系统上安装文件是不够的,您需要运行Apache或类似软件(通常通过XAAMP/WAMP/MAMP或类似软件)才能运行它。
http://localhost/myscript.php