2013-02-10 55 views
-1

我與RedBeansPHP 3.3工作,並有由RedBeans findOne創建以下PHP對象調用$結果:如何訪問RedBeansPHP對象的第二個Arrray?

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的語法?

$結果 - > ??????? - >鍵入[我是收?]

謝謝!

+0

的'__info'陣列屬性是'private'財產,這意味着除非你修改類爲它編寫getter方法,你不能訪問它。我不能像你的'$ result'那樣從一個對象變量中訪問。 – 2013-02-10 15:38:05

+0

不知道[API](http://redbeanphp.com/api/da/d65/class_red_bean___o_o_d_b_bean.html)是否已經提供了訪問它的方法。 – 2013-02-10 15:40:09

+0

我可以通過說'$ result-> ip'或者任何ip來訪問整個第一個數組。這也被稱爲「私人」。站在理由我應該能夠訪問第二個數組? – 2013-02-10 15:45:04

回答

0

想要任何人知道誰在尋找我從RedBeans創建者那裏得到的答案。

你可以這樣訪問RedBeans類型:

$beanTable = $bean->getMeta('type');