Hello everyone, I encountered a problem when I was using php to do a project.
If you want to output a piece of html content with <?php ... ?>, usually write include or require file name at the end for output.
But I put this HTML content directly in the database. If I want to output it, can I only create a temporary file first, and then use the include temporary file name to output it? Is there any other way?
滿天的星座2017-05-16 13:16:51
You can directly Eval, but there are security risks
eval(preg_replace('/^<]?php|\?>/', '', str))
给我你的怀抱2017-05-16 13:16:51
For example, the cache after template compilation mostly uses temporary files. If you want to store it in the database, you can also use the eval function. However, it is recommended to use cache files. The database must not be well designed.