开发者

How to insert PHP code into table in database?

开发者 https://www.devze.com 2023-04-01 08:36 出处:网络
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'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"

开发者_Go百科

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消