PHP and SWF Communication

Source: Internet
Author: User
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

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.