在全局范围内执行代码 [英] Execute code in global scope

查看:68
本文介绍了在全局范围内执行代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。


首先抱歉我的英语,我是意大利语。


如何执行函数中代码的一部分进入全局

范围?


示例:


<? php

$ var =" hello world" ;;

function myfunc(){

eval(" echo $ var;") ;

}

myfunc();

?>


我需要看到& ;你好世界。


有什么解决方案吗?

Hi to everybody.

First of all sorry for my english, I''m italian.

How can I execute a portion of code, in a function, into the global
scope?

Example:

<?php
$var="hello world";
function myfunc(){
eval("echo $var;");
}
myfunc();
?>

I need to see "hello world".

Is there any solution?

推荐答案

var =" ; hello world" ;;

函数myfunc(){

eval(" echo
var="hello world";
function myfunc(){
eval("echo


var;");

}

myfunc();

?>


我需要查看hello world ;。


有什么解决方案吗?

var;");
}
myfunc();
?>

I need to see "hello world".

Is there any solution?


m。***** @ gmail.com 写道:

您好大家好。首先抱歉我的英文,我是意大利人。

如何在函数中执行一部分代码到全局?范围?

示例:

<?php

Hi to everybody.

First of all sorry for my english, I''m italian.

How can I execute a portion of code, in a function, into the global
scope?

Example:

<?php


这篇关于在全局范围内执行代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆