无法访问PHP的一些对象属性(RedBeanPhp对象)

时间:2014-05-19 22:26:58

标签: php object properties get redbean

我的对象是var_dump。这是输出。在我的代码对象中是$ d-> depositType。当我回显$ d-> depositType-> id或$ d-> depositType->年时,我得到了我想要的值。但是,当我尝试获取$ d-> depositType-> name或$ d-> depositType-> name时,我得到null。请有人帮帮我。谢谢。

    object(RedBean_OODBBean)[47]
      private 'flagSkipBeau' => boolean false
      private 'properties' => 
        array (size=4)
          'id' => string '1' (length=1)
          'Name' => string 'Year Deposit' (length=12)
          'Percentage' => string '10.00' (length=5)
          'years' => string '1' (length=1)
      private '__info' => 
        array (size=4)
          'type' => string 'depositType' (length=11)
          'sys.id' => string 'id' (length=2)
          'sys.orig' => 
            array (size=4)
              'id' => string '1' (length=1)
              'Name' => string 'Year Deposit' (length=12)
              'Percentage' => string '10.00' (length=5)
              'years' => string '1' (length=1)
          'tainted' => boolean false
      private 'beanHelper' => 
        object(RedBean_BeanHelper_Facade)[21]
      private 'fetchType' => null
      private 'withSql' => string '' (length=0)
      private 'withParams' => 
        array (size=0)
          empty
      private 'aliasName' => null
      private 'via' => null
      private 'writeOnly' => boolean false

1 个答案:

答案 0 :(得分:0)

PHP对变量区分大小写:http://www.php.net/manual/en/language.variables.basics.php

$d->depositType->name不存在。

$d->depositType->Name