.cgi 文件顶部的“#!/usr/bin/env php”是什么意思?与“#!/usr/bin/php”相比?
我通常会
#!/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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
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.这在 env 的维基百科页面上有记录。它基本上运行命令而不修改现有的环境变量。
This is documented on the Wikipedia page for env. It basically runs the command without modifying existing environment variables.