douyongdao4046 2016-11-30 15:57
浏览 623
已采纳

如何从Laravel返回的数组中获取键的值

A raw query in Laravel is returning the below output when I print_r() it.

Array ( [0] => stdClass Object ( [AUTO_INCREMENT] => 28 ) )

How can I extract just the value of AUTO_INCREMENT? In this example, the value being 28.

  • 写回答

1条回答 默认 最新

  • doutui9606 2016-11-30 15:59
    关注

    The value is a property from a stdClass.

    Lets say you have this:

    $result; \\your ex
    echo $result[0]->AUTO_INCREMENT; \\this would echo 28.
    

    You can read more here how to fetch property from object

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?