映射 PHP 和 Flex 对象
我正在使用 ZendAMF 进行远程处理。
<?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
?>
我的问题是我有一个 ActionScript 类会话和一个 PHP 类会话,但它仍然没有被映射。 我有一些疑问...可能很愚蠢...
PHP 类的文件名是否应该与类名相同,因为它不是必需的,但在映射时它是否带有值分数。
您将如何在 Flex 应用程序中调用这些映射对象。 我的方法如下所示,但不确定是否正确。
$server->setClassMap("会话", "会话"); 上面的函数是一个PHP和Flex类。
另外,我的 PHP 会话类位于 include 目录中,我应该指出在任何地方还是 ZendAMf 会处理它。
弹性代码。
var userSession:Session = new Session();
sessionHold.text = userSession.userid;
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要做一些不同的事情。 通常,这类似于将
[RemoteClass(alias="Session")]
添加到 AS 类的元数据中,或者在 PHP 对象中使用 Zend_Amf 的函数之一,例如 getASClassName() 。 查看 Wade Arnold(Zend_Amf 的作者)的截屏视频:类映射。 我相信他会给你答案。
http://www.wadearnold.com/tutorials/zend/classmap/
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/
TypeOneError 正确; 您将需要
在 ActionScript 类的顶部。
我确定的其他一些因素也可能导致此问题:
TypeOneError is correct; you're going to need
at the top of your ActionScript classes.
A few other things that I've determined can cause this issue: