将局部变量导出到全局变量范围? [英] Export local variable to global variable scope?
本文介绍了将局部变量导出到全局变量范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我有一个功能,例如
function foo(){
include( " bar.php");
}
和bar.php包含内容,例如
$ global_v1 =" abc";
$ global_v2 =" def";
我想执行函数foo(),但与此同时,让bar.php中声明的
变量有可能具有全局范围吗?
谢谢。
Hello,
I have a function, e.g.
function foo() {
include("bar.php");
}
and the bar.php contain contents e.g.
$global_v1 = "abc";
$global_v2 = "def";
I want to execute function foo(), but at the same time, let the
variables declared in bar.php to have global scopem is it possible?
Thanks.
推荐答案
global_v1 =" abc";
global_v1 = "abc";
global_v2 =" def";
我想执行函数foo(),但同时,让bar.php中声明的
变量可以使用全局作用域吗?
>
谢谢。
global_v2 = "def";
I want to execute function foo(), but at the same time, let the
variables declared in bar.php to have global scopem is it possible?
Thanks.
howa写道:
howa wrote:
你好,
我有一个功能,例如
function foo() {
包括(bar.php);
}
和bar.php包含内容,例如
Hello,
I have a function, e.g.
function foo() {
include("bar.php");
}
and the bar.php contain contents e.g.
这篇关于将局部变量导出到全局变量范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文