问题描述
在 defined('YII_DEBUG') 或 define('YII_DEBUG', false);
代码行中,我们正在检查 debug 之前是否已定义,它将什么也不做,但如果没有,它将设置为假
.
In the defined('YII_DEBUG') or define('YII_DEBUG', false);
line of code we are checking if debug has defined previously it will do nothing but if not it will set to false
.
我没明白我的意思是如果我们想覆盖以前的值怎么办,为什么我们不能简单地做 define('YII_DEBUG', false);
如果我们不这样做,为什么有必要检查以前的值不想用那个?
I did not get this I mean what if we want to override previous value and why we cant simply do define('YII_DEBUG', false);
why it necessary to check previous value if we don't want to use that?
推荐答案
我没有做,但是你不清楚我的问题,我们只能更改/web/index.php 中的 YII_DEBUG 值.还有一件事,如果 YII_DEBUG 已经在其他任何地方定义了但之后如果我们想改变它的值该怎么做,因为 'or' 不会改变它,它也是不变的,所以不能改变它的值?
I didnt do it but you are not clear about my question, we can only change the YII_DEBUG value in /web/index.php. one more thing if YII_DEBUG has defined anywhere else but after that if we want to change its value what to do for that as 'or' will not change it and it is constant too so cant change its value?
是的,你错了...你可以在任何你想要的地方声明 YII_DEBUG 值,但是...如果它被重新定义:注意:常量 YII_DEBUG 已经定义在...我认为这就是 defined() 或...的原因,以防止出现此错误
Yes, you are very wrong... You can declare the YII_DEBUG value anywhere where you want, but... if it is redefined:Notice: Constant YII_DEBUG already defined in...I think thats the reason of defined() or... TO PREVENT THIS ERROR
这篇关于“defined('YII_DEBUG') 或"的用途是什么?在“定义('YII_DEBUG')或定义('YII_DEBUG',假);"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!