2016-03-06 17:38
浏览 69


I want to write a program with Yii so that users can have their template.

My solution is that every user has a record in a DB to keep a customized template like HTML code and some syntax like Smarty or Twig.

How can I use PHP to get that records and just print it on the screen and my template engine extracts syntax and shows best results? Is that possible or not? How should I do this?

Really you know if you save php codes in database, when you print them into a file, php codes you saved in database don't run. For me the most important thing is that to save template in database whit php commands and then echo them in a file and php code run same usually.

But is is important to use smarty or twig and don't let users add php codes directly.

图片转代码服务由CSDN问答提供 功能建议



如何使用PHP来获取 记录,只需将其打印在屏幕上,我的模板引擎提取语法并显示最佳结果? 这有可能吗? 我该怎么做?

真的你知道如果你把PHP代码保存在数据库中,当你把它们打印成文件时,保存在数据库中的php代码就不会运行了。 对我来说最重要的是在数据库中保存模板whit php命令然后在文件中回显它们并且php代码通常运行相同。


  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douqian1517 2016-03-07 14:20

    I found my answer. Just save every thing in database and when load them use eval() function. See documents in php and w3school.

    解决 无用
    打赏 举报

相关推荐 更多相似问题