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.

    评论

报告相同问题?

悬赏问题

  • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果