Is it possible to include PHP code that is in memory?
Say I have a vari开发者_StackOverflow中文版able containing PHP code, can I include its content as if it was a normal PHP file ?
For example, the PHP code could be a class declaration.
You don't have a variable containing php code. You have a string. You can execute a string as php with the evil eval function, but puppies AND kittens will die!
eval($your_variable);
Be aware about security holes!This is very dangerous and should NOT be based on user's input !
You could use eval
to evaluate any code that you have in your string, however it is evil. What exactly are you trying to do?
精彩评论