$_POST[''];怎么用
我在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里能用就行了。非常感谢!终于弄好了!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...
