Php 如何访问laravel 5.2中收集的数据

Php 如何访问laravel 5.2中收集的数据,php,laravel,laravel-5.2,Php,Laravel,Laravel 5.2,我在这张表格里有一个结果 RowCollection {#780 ▼ #heading: array:7 [▶] #title: "Sheet1" #items: array:3 [▶] } 我必须访问标题,但当我使用foreach循环时 foreach( $data as $key => $value){ echo $value; } 它打印出项目数组值。那么如何访问标题数组?根据我在laravel及其var#u转储程序中的经验,使用登录dd()输出签名的项目可以通过以下

我在这张表格里有一个结果

RowCollection {#780 ▼
  #heading: array:7 [▶]
  #title: "Sheet1"
  #items: array:3 [▶]
}
我必须访问标题,但当我使用foreach循环时

foreach( $data as $key => $value){
echo $value;
}

它打印出项目数组值。那么如何访问标题数组?

根据我在laravel及其var#u转储程序中的经验,使用
登录
dd()
输出签名的项目可以通过以下模式作为方法访问:

get{ItemStudlyCaseName}()

e、 g
getHeading()
getTitle()
getItems()

使用
+
符号签名的项目可以作为属性访问

完整描述

dd()
var\u转储程序输出中有三个符号:

#
受保护的属性

+
公共属性

-
私有财产

使用
$object->get{propertyStudyCaseName}()
模式的getter方法可以访问受保护的属性

公共属性可以直接访问<代码>$object->propertyName

无法访问私有属性

例如,在请求对象中:

Request {#38 ▼
  #json: null
  #convertedFiles: null
  #userResolver: Closure {#142 ▶}
  #routeResolver: Closure {#143 ▶}
  +attributes: ParameterBag {#40 ▶}
  +request: ParameterBag {#46 ▶}
  +query: ParameterBag {#46 ▶}
  +server: ServerBag {#42 ▶}
  +files: FileBag {#43 ▶}
  +cookies: ParameterBag {#41 ▶}
  +headers: HeaderBag {#44 ▶}
  #content: null
  #languages: null
  #charsets: null
  #encodings: null
  #acceptableContentTypes: null
  #pathInfo: "/"
  #requestUri: "/"
  #baseUrl: ""
  #basePath: null
  #method: "GET"
  #format: null
  #session: Store {#185 ▶}
  #locale: null
  #defaultLocale: "en"
  -isHostValid: true
  -isClientIpsValid: true
  -isForwardedValid: true
  basePath: ""
  format: "html"
}
e、 g

受保护的属性:
$request->getDefaultLocale()

+
公共属性:
$request->attributes


-
私有属性:
$request->isHostValid
=>返回null

根据我在laravel及其var#u转储程序中的经验,使用
登录
dd()
输出签名的项目可以通过以下模式作为方法访问:

get{ItemStudlyCaseName}()

e、 g
getHeading()
getTitle()
getItems()

使用
+
符号签名的项目可以作为属性访问

完整描述

dd()
var\u转储程序输出中有三个符号:

#
受保护的属性

+
公共属性

-
私有财产

使用
$object->get{propertyStudyCaseName}()
模式的getter方法可以访问受保护的属性

公共属性可以直接访问<代码>$object->propertyName

无法访问私有属性

例如,在请求对象中:

Request {#38 ▼
  #json: null
  #convertedFiles: null
  #userResolver: Closure {#142 ▶}
  #routeResolver: Closure {#143 ▶}
  +attributes: ParameterBag {#40 ▶}
  +request: ParameterBag {#46 ▶}
  +query: ParameterBag {#46 ▶}
  +server: ServerBag {#42 ▶}
  +files: FileBag {#43 ▶}
  +cookies: ParameterBag {#41 ▶}
  +headers: HeaderBag {#44 ▶}
  #content: null
  #languages: null
  #charsets: null
  #encodings: null
  #acceptableContentTypes: null
  #pathInfo: "/"
  #requestUri: "/"
  #baseUrl: ""
  #basePath: null
  #method: "GET"
  #format: null
  #session: Store {#185 ▶}
  #locale: null
  #defaultLocale: "en"
  -isHostValid: true
  -isClientIpsValid: true
  -isForwardedValid: true
  basePath: ""
  format: "html"
}
e、 g

受保护的属性:
$request->getDefaultLocale()

+
公共属性:
$request->attributes


-
私有属性:
$request->isHostValid
=>返回null

尝试
getHeading()
方法。尝试
getHeading()
方法。答案,这真是一个很好的回答,这真的很有帮助