映射 PHP 和 Flex 对象

发布于 2024-07-25 10:36:10 字数 955 浏览 4 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

沧桑㈠ 2024-08-01 10:36:10

您需要做一些不同的事情。 通常,这类似于将

[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/

月朦胧 2024-08-01 10:36:10

TypeOneError 正确; 您将需要

[RemoteClass(alias="Session")]
[Bindable]

在 ActionScript 类的顶部。

我确定的其他一些因素也可能导致此问题:

  • 类变量必须是公共的并且具有相同的名称
  • ActionScript 类不应具有已定义的构造函数

TypeOneError is correct; you're going to need

[RemoteClass(alias="Session")]
[Bindable]

at the top of your ActionScript classes.

A few other things that I've determined can cause this issue:

  • Class variables must be public and have identical names
  • The ActionScript class should not have a defined constructor
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文