require / include:常量与变量 [英] require/include: constant vs. variable
本文介绍了require / include:常量与变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到了一个我无法解决的愚蠢问题。请看例子:
settings.php
Hi,
I am stuck with a silly problem which I cant resolve. Please look at the example:
settings.php
展开 | 选择 | Wrap | 行号
推荐答案
常量具有全局范围,而变量和数组则不包含。
A constant has global scope whereas variables and arrays do not.
常量具有全局范围,而变量和数组不具有全局范围。
A constant has global scope whereas variables and arrays do not.
如果在开头有inlude / require行怎么样?
values.class.php
What about having inlude/require line at the beginning?
values.class.php
展开 | 选择 | Wrap | 行号
如果在开头使用inlude / require行怎么样?
What about having inlude/require line at the beginning?
任何包含settings.php的文件都可以看到数组,但函数或类是一个单独的实体。
如果你想要一个函数或类方法来查看它必须包含在函数中的数组。
但通常你只需将变量名作为参数传递给函数
Any file that includes settings.php can see the array, but a function or class is a seperate entity again.
If you want a function or class method to see the array it has to be included inside the function.
But normally you would simply pass the variable name in to the function as a parameter
这篇关于require / include:常量与变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文