本文介绍了你怎么跑用PHP命令行程序(如跛脚或SVN)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

具体来说,我需要的音频文件的编码自动与LAME MP3。你不需要知道LAME回答这个问题,我可以谈论SVN或其他程序。

Specifically, I need to automate the encoding of audio files into mp3 with LAME. You don't need to know LAME to answer this, I could be talking about svn or some other program..

我知道如何同时使用LAME在命令行上做到这一点,对于一个文件。

I know how to use LAME on the command line to do this, for one file at a time.

我想然而,通过PHP脚本做到这一点,这样我就可以立刻转换了一堆(例如,目录中的所有文件)

I would like to do this via a php script however, so I can convert a bunch at once (for instance, all the files in a directory)

所以,我感到困惑,是我应该如何调用该程序,LAME。我肯定可以使用
了shell_exec()

So what I am confused about, is how I should invoke the program, LAME. I could definitely use shell_exec()http://php.net/manual/en/function.shell-exec.php

不过是一个扭曲的方式做到这一点,因为我经历的壳呢?

But is that a "screwy" way to do it, since I am going through the shell?

我应该使用lame_enc.dll某种程度上代替,而不是lame.exe?

Should I be using lame_enc.dll somehow instead, instead of lame.exe?

好像我可以以某种方式与EXEC()实现还

It seems like I could somehow do it with exec() also http://php.net/manual/en/function.exec.php

但在这种情况下,如何将我提供的参数?

But in that case, how would I supply the arguments?

还是有更好的方式来做到这一点,也许一个.bat文件?我运行Windows

Or is there a better way to do it, maybe a .bat file? I am running windows

我应该使用lame_enc.dll代替lame.exe不知何故?

Should I be using lame_enc.dll instead of lame.exe somehow?

推荐答案

这是可能用PHP来做到这一点。不是一个典型的用例场景,但它可以做到的。既然你是在Windows上,一个bat文件会更适合,因为那么你并不需要PHP解析器来运行该脚本。

It's possible to do it with PHP. Not a typical use case scenario but it can be done. Since you are on Windows, a bat file would be better suited since then you don't need the PHP parser to run the script.

把你就会在控制台中运行你的音频文件转换LAME在* .BAT相同的命令。然后运行蝙蝠,就好像它是一个普通的可执行文件。

Put the same commands you would run in the console to convert your audio files with LAME in a *.bat. Then run the bat as if it was a regular executable file.

这篇关于你怎么跑用PHP命令行程序(如跛脚或SVN)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 01:05