-1

我正在使用 RedBeansPHP 3.3 并有以下由 RedBeans findOne 创建的名为 $result 的 PHP 对象:

RedBean_OODBBean Object
(
    [null:RedBean_OODBBean:private] => 
    [properties:RedBean_OODBBean:private] => Array
        (
            [id] => 10
            [datetime] => 2013-02-10 10:17:43
            [ip] => 68.32.52.219
            [vcode] => 6780-QBDY
            [roll1] => 7
            [roll2] => 8
            [roll3] => 10
            [roll4] => 6
            [roll5] => 1
            [roll6] => 4
            [roll7] => 2
            [roll8] => 4
            [roll9] => 2
            [roll10] => 8
        )

    [__info:RedBean_OODBBean:private] => Array
        (
            [type] => dice
            [sys.id] => id
            [tainted] => 
            [sys.orig] => Array
                (
                    [id] => 10
                    [datetime] => 2013-02-10 10:17:43
                    [ip] => 68.32.52.219
                    [vcode] => 6780-QBDY
                    [roll1] => 7
                    [roll2] => 8
                    [roll3] => 10
                    [roll4] => 6
                    [roll5] => 1
                    [roll6] => 4
                    [roll7] => 2
                    [roll8] => 4
                    [roll9] => 2
                    [roll10] => 8
                )

        )

    [beanHelper:RedBean_OODBBean:private] => RedBean_BeanHelper_Facade Object
        (
        )

    [fetchType:RedBean_OODBBean:private] => 
    [withSql:RedBean_OODBBean:private] => 
    [aliasName:RedBean_OODBBean:private] => 
)

我想访问[type] => dice第二个数组中的值。什么是 PHP 语法?

$result->?????????->type [我关闭了吗?]

谢谢!

4

1 回答 1

0

想让任何人知道谁在寻找我从 RedBeans 创建者那里得到的答案。

您可以通过以下方式访问 RedBeans 类型:

$beanTable = $bean->getMeta('type');
于 2013-03-01T03:55:06.163 回答