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.

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

报告相同问题?

悬赏问题

  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试