问题描述
基本上,该文件在从 Windows7 到 Ubuntu 的过程中的某些地方被破坏了.
Basically, the file was broken some where along the way from Windows7 to Ubuntu.
如何查看文件的二进制表示以了解发生了什么?
How can I look at a binary representation of the file to see what happened?
推荐答案
PHP 命令行脚本仍然必须在其中包含 opener.
PHP command line script still have to have the <? opener in them.
#!/usr/bin/php
echo "hi mom!\n";
不行,必须要
#!/usr/bin/php
<?php
echo "hi mom!\n";
这是因为没有php脚本"这样的东西.只有各种文本文件嵌入了 PHP 代码块.即使在 CLI 模式下,PHP 也期望/要求至少看到一个 <? 块.否则解释器不会启动,也不会看到任何代码,即使您已经声明它是带有 shebang 的 PHP 脚本.
This is because there's no such thing as a "php script". There are only various text files that have PHP code blocks embedded within them. Even in CLI mode, PHP expects/requires to see at least one <? block. Otherwise the interpreter won't kick in and won't see any of the code, even though you've stated it's a PHP script with the shebang.
PHP cli 模式基本上是事后的想法.PHP 最初是作为一个服务器端 CGI 脚本解析器,并没有从根本上改变这种模式.
PHP cli mode is basically a hacked-in afterthought. PHP started out as a server-side CGI script parser and has not fundamentally changed from that mode.
这篇关于舍邦#!在 Ubuntu 中无法识别,在 Windows7 中创建的文件 |编码疑难解答的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!