简体   繁体   English

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

[英]Can't access some of the object properties PHP (RedBeanPhp object)

I have var_dump of my object. 我的对象有var_dump。 Here is the output. 这是输出。 In my code object is $d->depositType. 在我的代码对象中是$ d-> depositType。 When I echo $d->depositType->id or $d->depositType->years I get the values I want. 当我回显$ d-> depositType-> id或$ d-> depositType-> years时,我得到了想要的值。 But when I try to get to $d->depositType->name or $d->depositType->name I get null. 但是,当我尝试获取$ d-> depositType-> name或$ d-> depositType-> name时,我得到了null。 Could somebody please help me.Thanks in advance. 有人可以帮我吗,谢谢。

    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

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

$d->depositType->name does not exists. $d->depositType->name不存在。

$d->depositType->Name does. $d->depositType->Name可以。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM