小白求问这类复杂对象的数组如何取某个值

2020-03-27 19:13:06 +08:00
 ifwangs
LeanCloud\LeanObject Object
(
[_className:LeanCloud\LeanObject:private] => Comment
[_data:LeanCloud\LeanObject:private] => Array
(
[objectId] => byz6
[nick] => kiss
[updatedAt] => DateTime Object
(
[date] => 2020-03-27 17:53:46.268000
[timezone_type] => 3
[timezone] => PRC
)

[mail] => gu*****hao@qq.com
[ua] => Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3650.400 QQBrowser/10.4.3341.400
[insertedAt] => DateTime Object
(
[date] => 2019-04-06 16:52:21.524000
[timezone_type] => 3
[timezone] => PRC
)

[emailHash] => 5087d65a917e9373cf77a87497d018ae
[createdAt] => DateTime Object
(
[date] => 2019-04-06 16:52:21.524000
[timezone_type] => 3
[timezone] => PRC
)

[link] => http://www.*****.vip
[comment] =>
kiss 友链



[url] => /links.html
[isNotified] => 1
)

[_operationSet:LeanCloud\LeanObject:private] => Array
(
)

[_saveOption:LeanCloud\LeanObject:private] =>
)



比如我要取 objectId 应该怎么写
2228 次点击
所在节点    PHP
3 条回复
xiaoming1992
2020-03-27 19:22:48 +08:00
没有格式的,没人能看懂
littleylv
2020-03-27 19:47:56 +08:00
看源码哟
https://github.com/leancloud/php-sdk/blob/master/src/LeanCloud/LeanObject.php#L221
$a->getObjectId()
或者 $a->get('objectId')
其他字段没有暴露 getX 方法,可以通过 $a->get('mail') https://github.com/leancloud/php-sdk/blob/master/src/LeanCloud/LeanObject.php#L304
ifwangs
2020-03-27 22:27:02 +08:00
@littleylv 感谢,一遍遍的看文档,看到怎么处理了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/656903

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX