<legend id='SVtAG'><style id='SVtAG'><dir id='SVtAG'><q id='SVtAG'></q></dir></style></legend>
      • <bdo id='SVtAG'></bdo><ul id='SVtAG'></ul>

      <tfoot id='SVtAG'></tfoot>
      <i id='SVtAG'><tr id='SVtAG'><dt id='SVtAG'><q id='SVtAG'><span id='SVtAG'><b id='SVtAG'><form id='SVtAG'><ins id='SVtAG'></ins><ul id='SVtAG'></ul><sub id='SVtAG'></sub></form><legend id='SVtAG'></legend><bdo id='SVtAG'><pre id='SVtAG'><center id='SVtAG'></center></pre></bdo></b><th id='SVtAG'></th></span></q></dt></tr></i><div id='SVtAG'><tfoot id='SVtAG'></tfoot><dl id='SVtAG'><fieldset id='SVtAG'></fieldset></dl></div>

    1. <small id='SVtAG'></small><noframes id='SVtAG'>

    2. php框架中库和助手的区别

      时间:2024-08-14
    3. <small id='Tr05x'></small><noframes id='Tr05x'>

        <tfoot id='Tr05x'></tfoot>
          <tbody id='Tr05x'></tbody>

            <i id='Tr05x'><tr id='Tr05x'><dt id='Tr05x'><q id='Tr05x'><span id='Tr05x'><b id='Tr05x'><form id='Tr05x'><ins id='Tr05x'></ins><ul id='Tr05x'></ul><sub id='Tr05x'></sub></form><legend id='Tr05x'></legend><bdo id='Tr05x'><pre id='Tr05x'><center id='Tr05x'></center></pre></bdo></b><th id='Tr05x'></th></span></q></dt></tr></i><div id='Tr05x'><tfoot id='Tr05x'></tfoot><dl id='Tr05x'><fieldset id='Tr05x'></fieldset></dl></div>

              <legend id='Tr05x'><style id='Tr05x'><dir id='Tr05x'><q id='Tr05x'></q></dir></style></legend>

              • <bdo id='Tr05x'></bdo><ul id='Tr05x'></ul>
                本文介绍了php框架中库和助手的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                如果我有我经常使用的字符串函数,我应该将它们放在帮助类还是库类中?

                if i've got string functions i use a lot, should i put them in a helper class or a library class?

                函数如:截断超过 30 个字符的字符串、返回随机字符串、全部小写等等.这些是我可能不需要为其创建对象的功能.最好将它们用作静态方法.

                functions like: truncate string if longer than 30 characters, return a random string, make all lower cases and so on. these are functions that i probably don't need to create an object for. it's better to use them as static methods.

                我应该将它们放在库类还是助手类中?

                should i put them in a library class or a helper class?

                我什么时候知道什么时候放哪里?

                when do i know when to put where?

                推荐答案

                Helper 是帮助已经存在的东西的类,例如可以有一个 helper:

                Helpers are the classes that help something already there for example there can be a helper for:

                数组
                字符串
                网址
                等等

                库可以是任何解决方案;它可能是您第一次创建的,没有其他人创建过.

                A library is something that can be any solution; it could be created for the first time by you and no one else has created.

                因为你正在处理一个字符串(已经存在的东西),你应该把它放在一个帮助类中,或者修改框架的字符串帮助类(如果有的话).然而,这是一个约定或标准,但如果您正在为具有相当多功能的字符串处理创建一些非常酷的东西,您也可以为它创建一个库.

                Because you are dealing with a string (something already there), you should put it in a helper class, or modify the string helper class of the framework (if there is one). However, this is a convention or standard but you can create a library for it too if you are creating something really cool for string handling with quite some functions.

                这篇关于php框架中库和助手的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:为什么“没有这样的文件或目录... autoload.php"?访问 Laravel 应用程序时? 下一篇:如何在 laravel 5.3 中对多张图片上传进行验证

                相关文章

                <small id='2iB0i'></small><noframes id='2iB0i'>

                <legend id='2iB0i'><style id='2iB0i'><dir id='2iB0i'><q id='2iB0i'></q></dir></style></legend>
                <tfoot id='2iB0i'></tfoot>

                  <i id='2iB0i'><tr id='2iB0i'><dt id='2iB0i'><q id='2iB0i'><span id='2iB0i'><b id='2iB0i'><form id='2iB0i'><ins id='2iB0i'></ins><ul id='2iB0i'></ul><sub id='2iB0i'></sub></form><legend id='2iB0i'></legend><bdo id='2iB0i'><pre id='2iB0i'><center id='2iB0i'></center></pre></bdo></b><th id='2iB0i'></th></span></q></dt></tr></i><div id='2iB0i'><tfoot id='2iB0i'></tfoot><dl id='2iB0i'><fieldset id='2iB0i'></fieldset></dl></div>
                    • <bdo id='2iB0i'></bdo><ul id='2iB0i'></ul>