.cgi 文件顶部的“#!/usr/bin/env php”是什么意思?与“#!/usr/bin/php”相比?

发布于 2024-09-11 11:56:39 字数 257 浏览 2 评论 0原文

我通常会

#!/usr/bin/php

看到或

#!/usr/bin/perl

在 CGI 文件的顶部 有何

#!/usr/bin/env php

。 a或

#!/usr/bin/env perl

与前两行 不同?他们也能工作。

I usually see

#!/usr/bin/php

or

#!/usr/bin/perl

at the top of a CGI file. How is a

#!/usr/bin/env php

or

#!/usr/bin/env perl

different from the first 2 lines? They work as well.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

路还长,别太狂 2024-09-18 11:56:39

Shebangs(脚本的 #!/usr/bin/sh 部分)需要解释器的绝对路径。由于某些解释器没有标准路径,因此某些脚本使用#!/usr/bin/envterpreter来启动正确的解释器。

Shebangs, the #!/usr/bin/sh part of the script, require an absolute path to the interpreter. Because there is no standard path for some interpreters some scripts use #!/usr/bin/env interpreter to launch the correct interpreter.

请恋爱 2024-09-18 11:56:39

这在 env 的维基百科页面上有记录。它基本上运行命令而不修改现有的环境变量。

This is documented on the Wikipedia page for env. It basically runs the command without modifying existing environment variables.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文