本文介绍了Laravel中的契约与PHP中的接口有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,Laravel将它作为Contracts扩展的接口引用,因为它们被Laravel使用。但这似乎有点像循环推理。仅仅因为您的项目使用它,更改现有PHP功能的术语没有任何附加值。

As far as I can tell, Laravel refers to the interfaces it extends as Contracts because they are used by Laravel. But this seems a bit like circular reasoning. There is no value added in changing the terminology of an existing PHP feature simply because your project uses it.

还有更多内容吗?为标准PHP功能创建新术语背后的逻辑是什么?或者是否有一些尚未在接口中的合同功能?

Is there something more to it? What's the logic behind coining a new term for something that's a standard PHP feature? Or is there some feature of Contracts that are not already in Interfaces?

编辑:为了澄清,它是合同作为专有名词的用法在我困惑的文档中,正如我对的评论中所解释的那样

Edit: To clarify, it's the usage of Contract as a proper noun in the documentation that has me confused, as explained in my comment on Thomas's post

推荐答案

描述使用接口的想法只是一个好词。

It's just a nice word to describe the idea of using interfaces.

Laravel合约只是PHP接口,因此它们不提供任何其他功能。

Laravel contracts are just PHP interfaces so they don't provide any other functionality.

您可以阅读更多关于此主题的

You can read more on this subject in the documentation http://laravel.com/docs/5.1/contracts

这篇关于Laravel中的契约与PHP中的接口有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 17:52