我想用那样的eval()函数:未定义函数eval() - PHP
$foo = 'eval';
$bar = 'echo 1;';
$foo($bar);
但我发现了一个错误:致命错误:调用未定义的函数eval()
,由于下面的代码工作它
$foo = 'base64_encode';
$bar = 'foobar';
echo $foo($bar);
谁能帮助奇怪?
我想用那样的eval()函数:未定义函数eval() - PHP
$foo = 'eval';
$bar = 'echo 1;';
$foo($bar);
但我发现了一个错误:致命错误:调用未定义的函数eval()
,由于下面的代码工作它
$foo = 'base64_encode';
$bar = 'foobar';
echo $foo($bar);
谁能帮助奇怪?
Note: Because this is a language construct and not a function, it cannot be called using variable functions .
继在注意链接,你还会发现:
Variable functions won't work with language constructs such as
echo
,unset()
,isset()
,empty()
,include
,require
and the like. Utilize wrapper functions to make use of any of these constructs as variable functions.
这是因为它是邪恶的! – adeneo