映射PHP和Flex对象 [英] Mapping PHP and Flex Objects

查看:171
本文介绍了映射PHP和Flex对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ZendAMF进行​​远程处理。

 <?php 
error_reporting(E_ALL | E_STRICT); //错误报告,不需要

require_onceZend / Amf / Server.php; // zendAMF服务器
require_onceprocess.php; //我们的测试类

$ server = new Zend_Amf_Server(); //声明服务器

$ server-> setClass(process); //将我们的测试类加载到服务器
$ server-> setClassMap(Session,Session);
echo($ server-> handle()); //需要启动服务器
?>

我的问题是我有一个ActionScript类会话和一个PHP类会话,但仍然没有得到映射。我有一些怀疑...可能会很傻...

应该把PHP类的文件名改为同名的类名,因为它不是必须的,而是while映射是否带有值得分。

如何在Flex应用程序中调用这些映射对象。我的方法如下所示,但不知道是否正确。

$ server-> setClassMap(Session,Session);
这是上面函数中的一个PHP和Flex类。

另外我的PHP会话类在include目录中,我应该在哪里指出,或者是ZendAMf



Flex代码

  var userSession :Session = new Session(); 
sessionHold.text = userSession.userid;

谢谢。

解决方案

你需要做几件不同的事情。通常这就像添加到元数据中的
$ b

你的AS类或者在你的PHP对象中使用Zend_Amf的一个函数,比如getASClassName()。看看韦德·阿诺德(Zend_Amf的作者)的屏幕录像:类映射。我相信他会有你的答案。



http://www.wadearnold.com/tutorials/zend/classmap/


I am using ZendAMF for remoting.

<?php
    error_reporting(E_ALL | E_STRICT); //error reporting, not needed

    require_once "Zend/Amf/Server.php"; //the zendAMF server
    require_once "process.php";  //our test class

    $server = new Zend_Amf_Server(); //declare the server

    $server->setClass("process"); //load our test-class to the server
    $server->setClassMap("Session", "Session");
    echo($server->handle()); // needed to start the server
?>

My Question is i have a ActionScript class Session and a PHP Class Session, but still it does not get mapped. I have some doubts... may be silly...

Should the file name of PHP class to be the same name of class name, as its not necessary but while mapping does it carry a value score.

How will you call those mapped objects inside your flex application. My approach is indicated below, but not sure whether its correct or not.

$server->setClassMap("Session", "Session"); Which is a PHP and Flex class in the above function.

Also my PHP session class is inside the include directory, should i indicate that anywhere or the ZendAMf will take care of it.

Flex Code.

var userSession:Session = new Session();
sessionHold.text = userSession.userid; 

Thanks.

解决方案

There's a few different things that you need to do. Usually it's something like adding the

[RemoteClass(alias="Session")]

to the metadata of your AS class or using one of Zend_Amf's functions like getASClassName() in your PHP object. Check out Wade Arnold's (writer of Zend_Amf) screencast re: class mapping. I'm sure he'll have your answer.

http://www.wadearnold.com/tutorials/zend/classmap/

这篇关于映射PHP和Flex对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆