dongyan5141 2009-08-01 02:40
浏览 61

有没有办法在MySQL数据库中存储对各种PHP函数的调用而没有使用eval()的风险?

I'm building a very basic CMS for a specific project that contains numerous functions such as get_menu(), get_title(), get_recent(), etc. However, I want to be able to store templates, which would be echoed during page load, that contain said functions in the MySQL database.

Doing a str_replace for each possible function would be a pita and I realize that using eval() is at times dangerous. Is there a better, more efficient way to go about doing this? I'm pretty sure it can be done as this is how templates are set up in Textpattern.

  • 写回答

2条回答 默认 最新

  • dsghpgmay31938863 2009-08-01 03:10
    关注

    For the reason you mention, I think you're better off using Smarty or some other templating language. If you want to load your templates dynamically, just store the filenames instead.

    评论

报告相同问题?

悬赏问题

  • ¥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 悬赏!微信开发者工具报错,求帮改