我在flash里定义了message交给了post,然后phph里写$_POST['message'];想通过这样和actionscript交互,但是php编译通不过,错误信息是message没有定义。
回复讨论(解决方案)
那你看看都传了什么过来呀
把你代码贴出来
那你看看都传了什么过来呀
大版主大人
你接触过actionscript吗,这是我在网上找的actionscript代码,这个代码我也看不明白啊,这里面message应该是URLVariables的一个成员吧。而且它是属于对象values的,如果在php里直接写$_POST['message'];php怎么知道这个message是什么啊
var loader:URLLoader = new URLLoader();//声明一个URLRequestvar url:URLRequest = new URLRequest("test.php");//设置传输方式为POSTurl.method = URLRequestMethod.POST;//声明一个URLVariablesvar values:URLVariables = new URLVariables();//设置要传输的信息values.message="hello im flash!"; url.data = values;loader.addEventListener(Event.COMPLETE,loaded); function loaded(e:Event){ trace(loader.data); }loader.load(url);
把你代码贴出来
actionscript代码是这样
var loader:URLLoader = new URLLoader();//声明一个URLRequestvar url:URLRequest = new URLRequest("helloPhp.php");//设置传输方式为POSTurl.method = URLRequestMethod.POST;//声明一个URLVariablesvar values:URLVariables = new URLVariables();//设置要传输的信息values.message = "hello im flash!";url.data = values;//监听数据加载完成事件loader.addEventListener(Event.COMPLETE,loaded);function loaded(e:Event){ //在flash输出栏里输出php传来的数据 trace(loader.data); }loader.load(url);
php是这样
<?php$data = 'hello im php~';echo $data;echo $_POST['message'];?>
预期效果是flash输出栏里显示“hello im php~"
php显示”hello im php~hello im flash!“
实际效果是php第四行编译通不过,说message没定义。
如果注释掉第四行则php显示”hello im php~“
flash输出栏把整个php文件的文本内容全部显示出来了,而不是显示”hello im php~“
把整个php文件的文本内容全部显示出来了
这是什么意思?
把整个php文件的文本内容全部显示出来了
这是什么意思?
这个样子:
你的 flash 不是从网站上加载的?
var url:URLRequest = new URLRequest("helloPhp.php");
应为
var url:URLRequest = new URLRequest("http://localhost/helloPhp.php");
你的 flash 不是从网站上加载的?
var url:URLRequest = new URLRequest("helloPhp.php");
应为
var url:URLRequest = new URLRequest("http://localhost/helloPhp.php");
原来是这样,php给actionscript传值弄好了,可是as传给php的message怎么弄啊。
echo $_POST['message'];
不行吗?
那这样呢
echo file_gey_contents('php://input');
你的 flash 不是从网站上加载的?
var url:URLRequest = new URLRequest("helloPhp.php");
应为
var url:URLRequest = new URLRequest("http://localhost/helloPhp.php");
原来是这样,php给actionscript传值弄好了,可是as传给php的message怎么弄啊。
它说file_gey_contents()函数没有定义。flash接收的是echo输出的数据,可是如果要动态地获取php里的不同数据,如何刷新echo的输出呢
file_ge t_contents
echo $_POST['message'];
不行吗?
那这样呢
echo file_gey_contents('php://input');
10楼引用错了,没at到你,我在fla里测试echo $_POST['message'];调用成功了,但是如果发布成swf就死活弄不好,用apache编译php也通不过。算了fla里能用就行了。非常感谢!终于弄好了!

ThebestapproachforsendingemailsinPHPisusingthePHPMailerlibraryduetoitsreliability,featurerichness,andeaseofuse.PHPMailersupportsSMTP,providesdetailederrorhandling,allowssendingHTMLandplaintextemails,supportsattachments,andenhancessecurity.Foroptimalu

使用依赖注入(DI)的原因是它促进了代码的松耦合、可测试性和可维护性。1)使用构造函数注入依赖,2)避免使用服务定位器,3)利用依赖注入容器管理依赖,4)通过注入依赖提高测试性,5)避免过度注入依赖,6)考虑DI对性能的影响。

phperformancetuningiscialbecapeitenhancesspeedandeffice,whatevitalforwebapplications.1)cachingwithapcureduccureducesdatabaseloadprovesrovesponsemetimes.2)优化

ThebestpracticesforsendingemailssecurelyinPHPinclude:1)UsingsecureconfigurationswithSMTPandSTARTTLSencryption,2)Validatingandsanitizinginputstopreventinjectionattacks,3)EncryptingsensitivedatawithinemailsusingOpenSSL,4)Properlyhandlingemailheaderstoa

TOOPTIMIZEPHPAPPLICITIONSFORPERSTORANCE,USECACHING,数据库imization,opcodecaching和SererverConfiguration.1)InlumentCachingWithApcutCutoredSatfetchTimes.2)优化的atabasesbasesebasesebasesbasesbasesbaysbysbyIndexing,BeallancingAndWriteExing

依赖性注射inphpisadesignpatternthatenhancesFlexibility,可检验性和ManiaginabilybyByByByByByExternalDependencEctenceScoupling.itallowsforloosecoupling,EasiererTestingThroughMocking,andModularDesign,andModularDesign,butquirscarecarefulscarefullsstructoringDovairing voavoidOverOver-Inje

PHP性能优化可以通过以下步骤实现:1)在脚本顶部使用require_once或include_once减少文件加载次数;2)使用预处理语句和批处理减少数据库查询次数;3)配置OPcache进行opcode缓存;4)启用并配置PHP-FPM优化进程管理;5)使用CDN分发静态资源;6)使用Xdebug或Blackfire进行代码性能分析;7)选择高效的数据结构如数组;8)编写模块化代码以优化执行。

opcodecachingsimplovesphperforvesphpermance bycachingCompiledCode,reducingServerLoadAndResponSetimes.1)itstorescompiledphpcodeinmemory,bypassingparsingparsingparsingandcompiling.2)useopcachebachebachebachebachebachebachebysettingparametersinphametersinphp.ini,likeememeryconmorysmorysmeryplement.33)


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

PhpStorm Mac 版本
最新(2018.2.1 )专业的PHP集成开发工具

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

记事本++7.3.1
好用且免费的代码编辑器