Possible to execute php string?
If I have a variable that contains PHP code... something like this:
$PageCode = "<?php\r\nrequire_once(\"../code/rushs_flickr_photos.php\");\r\开发者_如何学Cn?>";
Is it possible to execute that code within my page and assign it back to another variable? something like:
$PageContent = exec($PageCode);
Yes. You are looking for eval()
.
This is however considered very bad practice. Whatever it is that you are trying to do, there is most likely a better way.
Yes look at eval() function
精彩评论