How to insert PHP code into table in database?
I'm building an admin panel for some website, and I want to add the option to publish a new page. I want to build some text editor that will allow the publisher add HTML/PHP code.
I tried to insert text into dababase table and than print that:
EOF;
echo "1";
echo <<<EOF
But the output is "EOF; echo "1"; echo <<<EOF"
How can I add PHP/HTML code into my database table?
It's reversed, it should be
echo <<<EOF
echo "1";
EOF;
You can add php/html to the database like a normal, text. After when you retrieve your PHP code, if you want to execute it, you must use eval function.
精彩评论