从集合对象中获取价值

时间:2022-10-13 20:49:33

This may be quite silly to you, but for a learner like me is being a bit of a nightmare :(

这对你来说可能很愚蠢,但对于像我这样的学习者来说,这有点像噩梦:(

I have:

$memberObject->picturesCollection

And this shows in the console:

这显示在控制台中:

: object(Collection) = 
  elements: array = 
    0: object(Pic) = 
      fileName: string = %2Ffolder%2F2%2F9A246297-48CB-4A7A-92FB-B5C18D44E756.JPG
      bPicExists: bool = TRUE
  counter: long = 1
  pointer: long = 1

I need to get the fileName

我需要获取fileName

How can I do that??

我怎样才能做到这一点??

Thanks a ton!

万分感谢!

1 个解决方案

#1


0  

Something like that:

像这样的东西:

$memberObject->picturesCollection->elements[0]->filename

It depends on the visibility of the attributes. If they are private, you need to use getters.

这取决于属性的可见性。如果它们是私有的,则需要使用getter。

#1


0  

Something like that:

像这样的东西:

$memberObject->picturesCollection->elements[0]->filename

It depends on the visibility of the attributes. If they are private, you need to use getters.

这取决于属性的可见性。如果它们是私有的,则需要使用getter。