Get the App
SLTechnology News&Howtos  ›  Development  › 

How to deal with the garbled code from flash to php

Shulou Source: shulou.com Published: 2022-06-03 12:18:27 09月11日 Update

This article will explain in detail how to deal with the garbled code from flash to php. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Flash value to php garbled solution: 1, view all the Flash code; 2, add "header ('Content-Type:text/html;charset=utf-8');" at the beginning of PHP.

This article operating environment: Windows7 system, PHP7.1 version, Dell G3 computer

Specific problem description:

The communication between PHP and Flash is all garbled.

No more nonsense, just go to the code.

The full code of PHP is as follows:

Test

The full code of Flash is as follows:

Import flash.events.MouseEvent;import flash.net.URLRequest;import flash.net.URLLoader;import flash.events.Event;var url:String = "http://localhost/testing.php";var req:URLRequest=new URLRequest (); bt.addEventListener (MouseEvent.CLICK,clickHd); function clickHd (e:MouseEvent) {req.url = url;req.method = URLRequestMethod.POST;var loaded:URLLoader=new URLLoader (); loaded.dataFormat = URLLoaderDataFormat.VARIABLES;loaded.addEventListener (Event.COMPLETE,completeHd); try {msg.text =" requesting data. " ;} catch (err:Error) {msg.text = "error, try again later";} loaded.load (req);} function completeHd (e:Event) {msg.text = e.target.DataX navigateToURL (req);}

There is a msg dynamic text box and bt button in flash

Solution:

Add at the beginning of PHP

This line is fine, where UTF-8 is the code, and you modify it according to the Flash code.

This is the end of this article on "how to deal with garbled codes from flash to php". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Tags: Garbled code article method more coding problem starting good practical one line content dynamic nonsense buttons data text article being environment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Docker Huawei Shulou Information macOS