shell 命令中应该给出哪个路径?相对路径还是目录路径?

which path should be given in shell comand? relative path or diretcory path?

例如:我正在执行 shell 命令:

"ffmpeg -i input.flv -ss 00:00:14.435 -vframes 1 out.png"

此处 input.flv 路径应为 -> images\input.flv 或 D:\wamp\www\proj_name\public\images\input。 flv?

这取决于您当前的工作目录。一般来说,给出绝对路径更好,因为它们没有歧义。

如果您的路径是相对于您的工作目录(您调用 PHP 脚本的地方),它将起作用。但是有时在生产中该值会发生变化,从而导致奇怪的错误。如果你能以某种方式生成绝对路径(例如通过realpath()),它是首选。