Using variable in PHP exec [closed]

2020-03-30 07:32发布

问题:

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 7 years ago.

I want to use my variables in my PHP exec function:

exec('ffmpeg -i $audio_input $audio_output');

What is the right way of doing this? I dont want to change the ffmpeg script. Is it possible?

Thanks

回答1:

Use double quotes instead of single quotes:

exec("ffmpeg -i $audio_input $audio_output");

But please, go read this page: http://php.net/manual/en/language.types.string.php



回答2:

Replace with double quotes:

exec("ffmpeg -i $audio_input $audio_output");

Check the manual for Strings here.



回答3:

Use double quotes like mentioned before or

exec('ffmpeg -i '.$audio_input.' '.$audio_output);