SWF and PHP communication (Loadvars Class of Sendandload method, parse the XML way to take):
swf←php:php writes an XML file with Echo, and the SWF parses the file directly. (I used to wonder why the blue RSS is in PHP format and learned here.) )
SWF→PHP:SWF uses "Sendandload" (data_lv.uname= "Zhang San") to send variables, and PHP receives them with $name=$_post[' uname '.
Note:
1, the message is actually the two small process, PHP equivalent to a bridge. It is strongly recommended to write a simple example of 2 and 3, the example runs successfully, the message has not started to write the more than half has been completed.
2. Sendandload can either send variables to PHP or receive PHP variables (similar to SWF read text). Can see the volcano's tutorial, very detailed.
Start making (do the preparation above, the following will be well understood):
Figure 1
1. SWF reads data
① and ②mysql→php→swf
PHP takes "select" from MySQL and writes it as XML to read to SWF.
Figure 2
2. SWF Storage Data
③ and ④swf→php→mysql
SWF uses "Sendandload" to give php,php "INSERT" to MySQL.
Figure 3
Fix garbled (the Chinese read out in the database is "????" ):
Select the "utf8-geeral-ci" encoding when creating a database with Phpadmin.
In the PHP file before the query statement, plus: mysql_query ("Set names ' UTF8 '");
PHP modularity (easy to modify later):
The statements that connect to the database are written in a separate file, such as connectdb.php.
Write Data (datatosql.php) and read data (datatoxml.php) in the file Plus: Require "connectdb.php" can be.
MySQL Troubleshooting function (if the operation is wrong, according to the prompt can be easily modified):
Mysql_errno (error number); Mysql_error (cause of error).
PHP's Date function (for more details, refer to other help):
Data ("Ymd,l,h:i"); 20080608,sunday,09:28
SWF Real-time refresh (guaranteed to read the latest data):
SWF sends and gets real-time variables: data_lv.sendandload ("datatosql.php?n=" +random (9999), DATA_LV, "post");
SWF reads real-time Xml:myXML.load ("datatoxml.php?n=" +random (9999))
Reference from: http://dodomail.javaeye.com/blog/211003