dongtang1910 2016-09-09 13:44
浏览 83

我可以从控制器运行symfony命令吗?

I am making something like a forum in symfony where people can make stories in common, a bit like a roleplaying game.

When someone is showing that one character is talking the line will be shown with a font and color set by the owner of the character. So I write a sentence, select it and press a button with the name of the character, and internally wraps that sentence in a span with a classname that is the name of the character, so when the css reads that line it is formated.

Now the problem I have, my idea is that the owner of the character can modify the font or the style, so when I do that the controller generates a css file named like the character in a special folder. Then I can use the assetic component from symfony to load all the css files from that folder. The problem is that if I want to use them in production I need to run a special command from symfony (php bin/console assetic:dump --env=prod --no-debug).

The question now is, can I run that command from the controller? I guess not for security reasons.

I know that I can always make just one css with all the classes of the characters, but I would need to parse the file looking for the class and modifying it instead of just overwrite the file and let symfony do the rest.

If it isn't possible do you know someway my idea could be "easily" done?

Hi hope you can understand me, thanks

  • 写回答

2条回答 默认 最新

  • duanben1909 2016-09-09 13:51
    关注

    You can run commands from your PHP using the exec() function from php. I think there is probably a more clean and secure way to achieve what your trying to do, but regarding running commands with php, you can use exec(). Good luck with your project. Sounds cool.

    评论

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站