问题描述
我的问题是是否可以从 PHP 脚本中调用 Flex 的 fcsh.这是背景:
My question is whether or not Flex's fcsh can be called from within a PHP script. Here is the background:
我创建了一个简单的过程,该过程通过将文本文件转换为 .mxml 文件并使用 mxmlc 编译器编译为 .swf 文件来创建简单的测验/教程.这在命令行中运行良好,但我想通过创建一个 web 界面来使这个过程更容易.我对 PHP 的 exec() 函数的初步尝试没有奏效.我用来创建 .mxml 文件的 Python 脚本工作正常(使用 exec()),但我无法让 mxmlc 编译器工作.
I have been created a simple process that creates a simple quiz/tutorial by converting a text file into a .mxml file and compiling to a .swf file using the mxmlc compiler. This works well from the command line, but I wanted to make the process easier by creating a web-interface to do this. My initial attempts with PHP's exec() function have not worked. The Python scripts I use to create the .mxml file work fine (using exec()), but I have not been able to get the mxmlc compiler to work.
在网上和这个网站上搜索之后,我相信使用 fcsh(而不是 mxmlc)可能是要走的路.使用 fcsh 肯定会更快地编译 .mxml 文件(在第一次运行之后),而且我认为 fcsh 可以作为一个可以从 PHP 调用的服务启动.
After searching on the Web and on this site, I believe that using fcsh (instead of mxmlc) may be the way to go. Using fcsh would certainly compile the .mxml file faster (after the first run), and I think that fcsh can be launched as a service that might be able to be called from PHP.
另一方面,也许我以错误的方式处理这个问题.编写一个调用 fcsh 的 Flex 应用程序并避免使用 PHP 会更好吗?
On the other hand, maybe I am approaching this the wrong way. Would it be better to write a Flex application that calls fcsh and avoid using PHP?
使用 fcshctl 作为 hasseg 在他下面的回答中建议的效果非常好.谢谢阿里.
Using fcshctl as hasseg suggested in his answer below worked very well. Thanks Ali.
推荐答案
从脚本中调用 fcsh 的问题在于它作为一个交互式 shell 工作,而不是接受命令行参数、编译、并返回退出状态.有不同的方法可以解决这个问题,我在 我的这篇博文中列出了这些方法,在这里我主要讨论 fcshctl
(这是我自己的解决方案),但在帖子的底部,我还列出了其他类似的解决方案,以将 fcsh 集成到非标准构建工作流程中.
The problem with calling fcsh from within scripts is that it works as an interactive shell instead of taking command-line arguments, compiling, and returning an exit status. There are different ways to get around this, which I've listed in this blog post of mine, where I mainly talk about fcshctl
(which is my own solution for this,) but at the bottom of the post I've also listed other similar solutions to get fcsh integrated into nonstandard build workflows.
这篇关于从 PHP 脚本调用 fcsh的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!