Laravel中的With()与Compact() [英] With() vs Compact() in Laravel

查看:63
本文介绍了Laravel中的With()与Compact()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

with() compact()之间有什么区别吗?

Is there any difference between with() and compact() ?

哪个更有效?

推荐答案

with()是Laravel函数,而 compact()是PHP函数,它们完全不同目的.

with() is a Laravel function and compact() is a PHP function and have totally different purposes.

with()允许您将变量传递到视图,而 compact()从现有变量创建的数组作为字符串参数提供给它.

with() allows you to pass variables to a view and compact() creates an array from existing variables given as string arguments to it.

有关此问题的更多信息,请参见 compact().

See compact() for more info on this matter.

这篇关于Laravel中的With()与Compact()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆