如何执行存储在MySQL数据库中的PHP? [英] How do I execute PHP that is stored in a MySQL database?

查看:88
本文介绍了如何执行存储在MySQL数据库中的PHP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个页面,该页面调用存储在MySQL数据库中的PHP.存储在MySQL数据库中的页面包含要在页面加载时运行的PHP(和HTML)代码.

我该怎么做?

解决方案

您可以使用 eval 命令. 尽管如此,我还是建议这样做,因为使用这种方法会有很多陷阱.调试很难,这意味着存在一定的安全风险(执行错误的数据库内容,哦). /p>

例如,参见何时在php中出现邪恶?. Google for Eval就是邪恶的,您会找到很多为什么应该找到其他解决方案的例子.

添加:另一篇有关漏洞利用的好文章是此博客文章.指过去的vBulletin和phpMyAdmin漏洞,这些漏洞是由于Eval使用不当引起的.

I'm trying to write a page that calls PHP that's stored in a MySQL database. The page that is stored in the MySQL database contains PHP (and HTML) code which I want to run on page load.

How could I go about doing this?

解决方案

You can use the eval command for this. I would recommend against this though, because there's a lot of pitfalls using this approach. Debugging is hard(er), it implies some security risks (bad content in the DB gets executed, uh oh).

See When is eval evil in php? for instance. Google for Eval is Evil, and you'll find a lot of examples why you should find another solution.

Addition: Another good article with some references to exploits is this blogpost. Refers to past vBulletin and phpMyAdmin exploits which were caused by improper Eval usage.

这篇关于如何执行存储在MySQL数据库中的PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆