我喜欢使用该dd
函数进行调试.这次当我用它来显示约会列表时,我看不到(没有可点击的箭头)属性和原始数据.我得到[ …19]
显示的括号,不知道为什么.
Collection {#3061 ? #items: array:548 [? 0 => Appointment {#821 ? #table: "appointments" #fillable: array:16 [ …16] #connection: null #primaryKey: "id" #perPage: 15 +incrementing: true +timestamps: true #attributes: array:19 [ …19] #original: array:19 [ …19] #relations: array:2 [ …2] #hidden: [] #visible: [] #appends: [] #guarded: array:1 [ …1] #dates: [] #dateFormat: null #casts: [] #touches: [] #observables: [] #with: [] #morphClass: null +exists: true +wasRecentlyCreated: false } 1 => Appointment {#822 ?} 2 => Appointment {#823 ?} 3 => Appointment {#824 ?} 4 => Appointment {#825 ?} 5 => Appointment {#826 ?} 6 => Appointment {#827 ?} 7 => Appointment {#828 ?}
在后面的列表中,我甚至看不到内部约会(没有箭头):
81 => Appointment {#902 ?} 82 => Appointment {#903 ?} 83 => Appointment {#904 ?} 84 => Appointment {#905 ?} 85 => Appointment {#906 …23} 86 => Appointment {#907 …23} 87 => Appointment {#908 …23} 88 => Appointment {#909 …23} 89 => Appointment {#910 …23} 90 => Appointment {#911 …23}
但是当我使用var_dump时,我的数据看起来很好:
array(548) { [0]=> array(21) { ["id"]=> int(149) ["appointmenttype_id"]=> NULL ["appointmentlocationtype_id"]=> NULL ["appointment_start"]=> object(Carbon\Carbon)#812 (3) { ["date"]=> string(26) "2015-12-21 07:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "America/New_York" } ["appointment_end"]=> object(Carbon\Carbon)#811 (3) { ["date"]=> string(26) "2015-12-21 09:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "America/New_York" }
其他人经历过这种情况?
这是一个不太知名的警告,它返回了太大的结果列表.通常,dd()
它是对您要返回的数据的快速概述,并处理较小的数据组"向下钻取".一旦你达到一定数量(我忘了确切的一个,500可能?),该功能不再有效.
如果您在某个地方的代码中使用它之前绝对需要查看此数据,limit()
请get()
在结果之前使用一个子句,或者使用dd($example[0])
查看单个结果的详细信息.希望有所帮助!