PHP implements dynamic code execution, and php implements dynamic code. PHP implements dynamic code execution. This article describes how php implements dynamic code execution. For your reference, The following describes how PHP implements dynamic code execution and how php implements dynamic code.
This article describes how PHP implements dynamic code execution. We will share this with you for your reference. The details are as follows:
The PHP dynamic execution introduced here, that is, directly enter the code on the page, click execute, and return the execution result
The method is simple and mainly used:
$ Newfunc = create_function ('', $ code );
Function.
The code is as follows:
<? Php $ code = 'return "no code! "; '; If (isset ($ _ POST ['code']) & $ _ POST ['code']! = '') {$ Code = $ _ POST ['code'];} $ newfunc = create_function ('', $ code); $ res = $ newfunc ();?>
XXX<? Php echo $ res?>