Amfphp1.9 非beta版 相干情况
Amfphp1.9 非beta版 相关情况
1.编码问题
Fatal error: Uncaught exception 'VerboseException' with message 'Cannot modify header information
修正办法:
采用ANSI编码(这种搞起来,转换比较麻烦)或UTF8 no BOM,而非UTF8 with BOM
存为UTF8 no BOM模式:
DW参见:http://www.googlephp.cn/archives/tag/cannot-modify-header-information
DzSoft如图:
另外修改根目录下gateway.php (line127):
//$gateway->setCharsetHandler("utf8_decode", "ISO-8859-1", "ISO-8859-1");//注释掉,改为:
$gateway->setCharsetHandler("none", "ISO-8859-1", "ISO-8859-1");
2.NetStatusEvent
Flex/Flash 则报:
Error #2044: 未处理的 NetStatusEvent:。 level=error, code=NetConnection.Call.BadVersion
修正办法:
根目录下:
gateway.php(Line 132)
if(PRODUCTION_SERVER){//Disable profiling, remote tracing, and service browser//$gateway->disableDebug();//把它注释掉// Keep the Flash/Flex IDE player from connecting to the gateway. Used for security to stop remote connections.//$gateway->disableStandalonePlayer();//把它注释掉}
3.Save byteArray into Mysql with Amfphp
AS code:
package { import flash.display.Sprite; import flash.net.NetConnection; import flash.net.ObjectEncoding; import flash.net.Responder; import flash.utils.ByteArray; import flash.display.BitmapData; public class Test extends Sprite { private var nc:NetConnection; private var rsp:Responder; public function Test() { rsp = new Responder(onResult,null); nc = new NetConnection( ); nc.objectEncoding = ObjectEncoding.AMF3; nc.connect("http://127.0.0.1/AmfphpForWareHouse/gateway.php"); nc.call("warehouse.MyPage.create",rsp,getData()); } public function getData():Object { var obj:Object=new Object(); obj.firstName = "diding"; var bpd:BitmapData = new BitmapData(a.width,a.height); bpd.draw(a); var jpegEnc:JPEGEncoder = new JPEGEncoder(80); var dat:ByteArray = jpegEnc.encode(bpd); obj.pic = dat as ByteArray; return obj; } private function onResult( e: * ):void { trace(e); } }}
Php Code:
<?phprequire_once "ConnectionHelper.php";class MyPage{public function create($contact){$GLOBALS['amfphp']['encoding']='amf3';$times=date("Y-m-d H:i:s");$ps1=$contact['firstName'];$ba=$contact['pic'];$data = $ba->data;$data = mysql_real_escape_string($data);$result=mysql_query("INSERT INTO userinfo (firstname,pic,addTime)VALUES ('$ps1','$data','$times')");return $result;}}?>
这样能存入Mysql数据库了,但在返回给flash或flex时,会出现convert报错,这时需要返回前在map(类映射)中new一下:new byteArray();
如:
<?phpclass AppVO{ var $_explicitType ="vo.AppVO"; var $id; var $userName; var $email; var $phone; var $address; var $pic; public function AppVO(){} public function mapObject($obj) { $this->id = $obj['id']; $this->userName = $obj['username']; $this->email = $obj['email']; $this->phone = $obj['phone']; $this->address = $obj['address']; $this->pic =new ByteArray($obj['pic']); }}?>

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

AI Hentai Generator
Generate AI Hentai for free.

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



Function means function. It is a reusable code block with specific functions. It is one of the basic components of a program. It can accept input parameters, perform specific operations, and return results. Its purpose is to encapsulate a reusable block of code. code to improve code reusability and maintainability.

Solutions to 504 gateway timeout: 1. Check server load; 2. Optimize query and code; 3. Increase timeout limit; 4. Check proxy server; 5. Check network connection; 6. Use load balancing; 7. Monitor and log; 8. Troubleshooting; 9. Add cache; 10. Analyze requests. Resolving this error often requires a combination of factors, including server performance, network connectivity, proxy server configuration, and application optimization.

Flash is a software used to create multimedia and interactive content, with features such as vector graphics, timeline animation, interactivity, and multimedia processing capabilities. Although once very popular, Flash was gradually phased out with the rise of new technologies, and official support ceased in 2020.

This article brings you relevant knowledge about JavaScript. It mainly introduces the differences between var, let and const, as well as the relationship between ECMAScript and JavaScript. Interested friends can take a look at it. I hope Helpful to everyone.

In this article, we will learn about enumerate() function and the purpose of “enumerate()” function in Python. What is the enumerate() function? Python's enumerate() function accepts a data collection as a parameter and returns an enumeration object. Enumeration objects are returned as key-value pairs. The key is the index corresponding to each item, and the value is the items. Syntax enumerate(iterable,start) Parameters iterable - The passed in data collection can be returned as an enumeration object, called iterablestart - As the name suggests, the starting index of the enumeration object is defined by start. if we ignore

Detailed explanation of the role and function of the MySQL.proc table. MySQL is a popular relational database management system. When developers use MySQL, they often involve the creation and management of stored procedures (StoredProcedure). The MySQL.proc table is a very important system table. It stores information related to all stored procedures in the database, including the name, definition, parameters, etc. of the stored procedures. In this article, we will explain in detail the role and functionality of the MySQL.proc table

Audio output and input require specific drivers and services to work as expected on Windows 11. These sometimes end up running into errors in the background, causing audio issues like no audio output, missing audio devices, distorted audio, etc. How to Fix Audio Service Not Responding on Windows 11 We recommend you to start with the fixes mentioned below and work your way through the list until you manage to resolve your issue. The audio service may become unresponsive for a number of reasons on Windows 11. This list will help you verify and fix most issues that prevent audio services from responding on Windows 11. Please follow the relevant sections below to help you through the process. Method 1: Restart the audio service. You may encounter

Steps to configure default gateway: 1. Determine the IP address of the router; 2. Open the network configuration interface of the computer; 3. Configure network connection; 4. Configure IPv4 settings; 5. Enter the IP address and subnet mask; 6. Configure the default gateway ;7. Configure DNS server; 8. Save settings. Detailed introduction: 1. Determine the router's IP address. The default gateway address is usually the router's IP address. You can find the router's IP address on the back of the router or in the user manual; 2. Open the computer's network configuration, etc.
