ilay1678
V2EX  ›  PHP

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

  •  
  •   ilay1678 · Mar 27, 2020 · 2633 views
    This topic created in 2263 days ago, the information mentioned may be changed or developed.
    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*****[email protected]
    [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 应该怎么写
    3 replies    2020-03-27 22:27:02 +08:00
    xiaoming1992
        1
    xiaoming1992  
       Mar 27, 2020 via Android
    没有格式的,没人能看懂
    U7Q5tLAex2FI0o0g
        2
    U7Q5tLAex2FI0o0g  
       Mar 27, 2020
    看源码哟
    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
    ilay1678
        3
    ilay1678  
    OP
       Mar 27, 2020
    @littleylv 感谢,一遍遍的看文档,看到怎么处理了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2769 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 11:58 · PVG 19:58 · LAX 04:58 · JFK 07:58
    ♥ Do have faith in what you're doing.