【发布时间】:2020-05-09 22:53:00
【问题描述】:
编辑: 我在 github 中添加了一个存储库。在“欢迎”中打印结果。 https://github.com/Danven/borrar
LARAVEL 5.8
使用 VAR_DUMP(不同!!!!)
{{ var_dump( $person->cars()->pluck('cars.id') ) }}
本地机器(PHP 7.3.7):
object(Illuminate\Support\Collection)#1215 (1) {
["items":protected]=>
array(4) {
[0]=> int(1)
[1]=> int(2)
[2]=> int(3)
[3]=> int(4)
}
}
生产服务器(PHP 7.2.12):
object(Illuminate\Support\Collection)#1215 (1) {
["items":protected]=>
array(4) {
[0]=> string(1) "1"
[1]=> string(1) "2"
[2]=> string(1) "3"
[3]=> string(1) "4"
}
}
【问题讨论】:
-
看这个帖子是因为var_dumb和print_r的区别stackoverflow.com/questions/3406171/php-var-dump-vs-print-r