trace($this->_classResources,'$this->_classResources');
If I can get "$this->_classResources" then I don't need the second params.
如果我能得到“$ this - > _ classResources”那么我就不需要第二个参数了。
2 个解决方案
#1
3
You can't, and shouldn't be able to. There is probably a different way you could structure your code to get around this problem.
你不能,也不应该。您可以采用不同的方式构建代码以解决此问题。
#2
0
function print_var_name($var) {
foreach($GLOBALS as $var_name => $value) {
if ($value === $var) {
return $var_name;
}
}
return false;
}
This function will not directly get the variable name but it will scan for any variable name that contains the same value as the one you specify. If you can ensure that values passed in your function are different from all other values, it should do the job. The crappy method that could work is to set a prefix for the values that will be passed in this function. Once in the function, you just skip the prefix part with substr.
此函数不会直接获取变量名称,但会扫描包含与指定值相同的任何变量名称。如果您可以确保函数中传递的值与所有其他值不同,那么它应该完成这项工作。可能有用的蹩脚方法是为将在此函数中传递的值设置前缀。进入函数后,您只需使用substr跳过前缀部分。
#1
3
You can't, and shouldn't be able to. There is probably a different way you could structure your code to get around this problem.
你不能,也不应该。您可以采用不同的方式构建代码以解决此问题。
#2
0
function print_var_name($var) {
foreach($GLOBALS as $var_name => $value) {
if ($value === $var) {
return $var_name;
}
}
return false;
}
This function will not directly get the variable name but it will scan for any variable name that contains the same value as the one you specify. If you can ensure that values passed in your function are different from all other values, it should do the job. The crappy method that could work is to set a prefix for the values that will be passed in this function. Once in the function, you just skip the prefix part with substr.
此函数不会直接获取变量名称,但会扫描包含与指定值相同的任何变量名称。如果您可以确保函数中传递的值与所有其他值不同,那么它应该完成这项工作。可能有用的蹩脚方法是为将在此函数中传递的值设置前缀。进入函数后,您只需使用substr跳过前缀部分。