doulao3905 2013-06-08 10: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 11: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.

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

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改