闪光动作 - 保存在服务器上的文本文件 [英] Flash actionscript - save a text file on server
问题描述
好日子所有。我有一个小问题。
Good day to all. I have a little problem.
谁能告诉我,或提供关于如何保存为文本文件在服务器上的一些数据的用户插入一个链接或东西吗?
Can anyone tell me or give a link or something on how to save a text file on the server with some data a user inserted?
我需要这样做:我有一个文本框和后pressing进入我需要创建/添加一个文件,日志一个什么样的用户输入。我创建了中,添加监听器,但我不知道如何创建该文件。谢谢你的帮助。
I need to do this: I have a text box and after pressing enter I need to create/append a file with a log of what a user entered. I have created the box, add listener but I don't know how to create the file. Thank you for help.
推荐答案
使用的 flash.net.URLRequest
将数据发送到一个脚本,将数据保存到文件服务器上。
Use flash.net.URLRequest
to send the data to a script on the server that saves the data to a file.
Flash播放器不能访问服务器直接,因为它运行在客户端计算机上,所以你需要这样做的。
The Flash Player cannot access the server directly, as it runs on the client computer, so you need to do it that way.
// prepare the data to send, for example in a URLVariables object.
var vars:URLVariables = new URLVariables();
vars.userId = 1234;
vars.enteredData = 'Hello World';
// construct the URL request
var req:URLRequest = new URLRequest( 'myscript.php' );
req.method = URLRequestMethod.POST;
req.data = vars;
// open the URL request (you can for example listen to events and
// evaluate the script's response data etc)
var loader:URLLoader = new URLLoader( req );
这篇关于闪光动作 - 保存在服务器上的文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!