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

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

问题描述

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

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.

我该怎么做?

推荐答案

您可以使用 eval 命令.不过我建议不要这样做,因为使用这种方法有很多陷阱.调试很困难(呃),这意味着一些安全风险(数据库中的坏内容被执行,呃哦).

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).

例如,请参见 php 中的 eval 何时是邪恶的?.Google for Eval is Evil,您会找到很多示例,说明您应该寻找其他解决方案.

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.

补充:另一篇提到漏洞利用的好文章是这篇博文.指过去由于 Eval 使用不当导致的 vBulletin 和 phpMyAdmin 漏洞.

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天全站免登陆