我在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對性能的影響。

phpperformancetuningiscialbecapeitenhancesspeedandeffice,whatevitalforwebapplications.1)cachingwithapcureduccureducesdatabaseloadprovesrovessetimes.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
好用且免費的程式碼編輯器