这是一个脚本上周工作但不是现在的情况。我只能认为在Web主机上安装了一个新的(er)版本的PHP,该版本有一个错误。如果这是我的错,我看不出如何。那么,这是一个PHP错误,一个GoDaddy问题,或者是什么?确实会忽略注释字符?
下面只是整个脚本的一部分,但我已经将它缩减为这个名为'a.php'的小失败片段。对于那些失败的,点击提交按钮后,IE会说'这个页面不能显示';其他浏览器也显示失败。 PHP错误日志文件中没有错误。看起来评论字符被忽略。 'allow_url_fopen'为true,但声明不应该是运行脚本的一部分。这是在GoDaddy上的多个共享Linux主机上使用PHP v5.3.24和v5.4.19。我在本地WAMP安装(使用PHP v5.6.0或v5.4.23)上尝试了这些示例,它们都可以正常工作。
请注意,我不得不在下面的示例中将“http”变成“httpX”以获取此发布。
在完整的脚本中,我使用了最后一种方法让它再次工作,即将URL字符串移动到变量中,并将该变量用作函数的参数。
这三个失败:
// commented line at end
print "<form action=\"a.php\" method=\"POST\">";
print "<input type=\"submit\" name=\"submit\" /></p>";
print "</form>";
//file_get_contents('httpX://abc.com');
// commented line at beginning
//file_get_contents('httpX://abc.com');
print "<form action=\"a.php\" method=\"POST\">";
print "<input type=\"submit\" name=\"submit\" /></p>";
print "</form>";
// use other commenting characters
print "<form action=\"a.php\" method=\"POST\">";
print "<input type=\"submit\" name=\"submit\" /></p>";
print "</form>";
/*file_get_contents('httpX://abc.com');*/
这四个工作按预期:
// remove offending line
print "<form action=\"a.php\" method=\"POST\">";
print "<input type=\"submit\" name=\"submit\" /></p>";
print "</form>";
// change function name
print "<form action=\"a.php\" method=\"POST\">";
print "<input type=\"submit\" name=\"submit\" /></p>";
print "</form>";
//zile_get_contents('httpX://abc.com');
// change from URL to file
print "<form action=\"a.php\" method=\"POST\">";
print "<input type=\"submit\" name=\"submit\" /></p>";
print "</form>";
//file_get_contents(b.txt);
// set var to URL and use var as argument
print "<form action=\"a.php\" method=\"POST\">";
print "<input type=\"submit\" name=\"submit\" /></p>";
print "</form>";
//$u = 'httpX://abc.com';
//file_get_contents($u);
什么?你真正的问题是什么? – ElefantPhace
@ElefantPhace他有一个上周工作的脚本,现在停止工作,他问脚本中是否有什么不好的东西,他没有看到,他假设评论字符“//”被php忽略 – CodeBird
他们被忽略,他们是评论。他所拥有的只有三个相同的空格。你的预期产出是多少? – ElefantPhace