<bdo id='4NxKk'></bdo><ul id='4NxKk'></ul>

<small id='4NxKk'></small><noframes id='4NxKk'>

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

        <tfoot id='4NxKk'></tfoot>

      1. <legend id='4NxKk'><style id='4NxKk'><dir id='4NxKk'><q id='4NxKk'></q></dir></style></legend>
      2. yii2:抛出新异常的正确方法

        yii2: Proper way to throw new exception(yii2:抛出新异常的正确方法)

        <small id='UjIpk'></small><noframes id='UjIpk'>

        • <legend id='UjIpk'><style id='UjIpk'><dir id='UjIpk'><q id='UjIpk'></q></dir></style></legend>
            <bdo id='UjIpk'></bdo><ul id='UjIpk'></ul>
                <tbody id='UjIpk'></tbody>
              <tfoot id='UjIpk'></tfoot>
              1. <i id='UjIpk'><tr id='UjIpk'><dt id='UjIpk'><q id='UjIpk'><span id='UjIpk'><b id='UjIpk'><form id='UjIpk'><ins id='UjIpk'></ins><ul id='UjIpk'></ul><sub id='UjIpk'></sub></form><legend id='UjIpk'></legend><bdo id='UjIpk'><pre id='UjIpk'><center id='UjIpk'></center></pre></bdo></b><th id='UjIpk'></th></span></q></dt></tr></i><div id='UjIpk'><tfoot id='UjIpk'></tfoot><dl id='UjIpk'><fieldset id='UjIpk'></fieldset></dl></div>

                  本文介绍了yii2:抛出新异常的正确方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  只是为了测试,我在我的模型中添加了这段代码,同时设置了 debug = true 和 false.

                  Just for testing I have added this code in my model while setting the debug = true and false.

                  if($packagedays < 1)
                       {
                        throw new yiiaseException( "package days cannot be less than 1" );
                       }
                  

                  现在当 Yii 调试为真时:我得到了

                  Now when Yii debug is true: I am getting

                  异常 – yiiaseException包裹天数不能少于 1

                  但是当我将调试设置为 false 时我正进入(状态例外发生内部服务器错误.

                  But when I am setting the debug to false I am getting Exception An internal server error occurred.

                  上述错误发生在 Web 服务器处理您的请求时.

                  The above error occurred while the Web server was processing your request.

                  我想要的是替换发生内部服务器错误.包天数不能小于1debug=false

                  我在这里缺少什么?

                  谢谢.

                  推荐答案

                  你应该简单地抛出一个 UserException :

                  You should simply throw a UserException :

                  UserException 是旨在向最终用户显示的异常的基类.

                  UserException is the base class for exceptions that are meant to be shown to end users.

                  阅读更多:http://www.yiiframework.com/doc-2.0/yii-base-userexception.html

                  这篇关于yii2:抛出新异常的正确方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Is Joomla 2.5 much faster than Joomla 1.5 Querywise(Joomla 2.5 比 Joomla 1.5 Querywise 快得多吗)
                  How to share Joomla login session from one joomla website to one ASP.Net MVC website(如何将 Joomla 登录会话从一个 joomla 网站共享到一个 ASP.Net MVC 网站)
                  htaccess redirect root to subdirectory but allow index.php in root AND query strings to function(htaccess 将根重定向到子目录,但允许根和查询字符串中的 index.php 起作用)
                  Joomla include database functions(Joomla 包含数据库功能)
                  nl2br() not working when displaying SQL results(显示 SQL 结果时 nl2br() 不起作用)
                  Joomla 2.5 JFactory::getSession(); seems to be caching in firefox(Joomla 2.5 JFactory::getSession();似乎在 Firefox 中缓存)

                    <bdo id='aha3H'></bdo><ul id='aha3H'></ul>

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

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

                            <small id='aha3H'></small><noframes id='aha3H'>