doulao3905 2013-06-08 02:57
浏览 58
已采纳

从数据库中检索时,在HTML中嵌入PHP代码不起作用

I have an HTML template that is populated with information from a database and echo'd to user as a complete page. Inside one of the fields that is echo'd I tried to insert some php code e.g. but hello doesn't appear to the user, and when I check the source, it is red (nothing appears on the users screen). why would this be? I though that as long as you have a .php file you can embed php code no problem with html. Don't ask why I have the php code stored in a database, it's complicated!

  • 写回答

1条回答 默认 最新

  • doujiaci7976 2013-06-08 03:12
    关注

    You would need to use PHP's eval() function, please be careful with this though as it can pose a security risk.

    You should really address the underlying issue of why you are storing PHP code in a database.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部