<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框架中库和助手的区别

      difference between libraries and helpers in php frameworks(php框架中库和助手的区别)
    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框架中库和助手的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Converting between timezones in PHP(在 PHP 中的时区之间转换)
                PHP - strtotime, specify timezone(PHP - strtotime,指定时区)
                Get current date, given a timezone in PHP?(获取当前日期,给定 PHP 中的时区?)
                List of US Time Zones for PHP to use?(PHP 使用的美国时区列表?)
                How to detect Ambiguous and Invalid DateTime in PHP?(如何在 PHP 中检测不明确和无效的 DateTime?)
                How to update timezonedb in PHP (updating timezones info)?(如何在 PHP 中更新 timezonedb(更新时区信息)?)

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

                  <legend id='2iB0i'><style id='2iB0i'><dir id='2iB0i'><q id='2iB0i'></q></dir></style></legend>
                    <tbody id='2iB0i'></tbody>
                  <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>