简体   繁体   English

使用 fopen 获取语法错误

[英]getting syntax error using fopen

I have a php program on a GoDaddy linux server that is just trying to fopen, then fwrite to a file.我在 GoDaddy linux 服务器上有一个 php 程序,它只是试图 fopen,然后 fwrite 到一个文件。 It is erroring on the fopen statement.它在 fopen 语句上出错。

<?php
$filename = "calendar3.data";
$filedata = "Hello world";

$fp = fopen($filename, 'w');
//fwrite($fp, $filedata);
fclose($fp);

echo "file successfully written";

/*
PHP Parse error:  syntax error, unexpected ''w'' (T_CONSTANT_ENCAPSED_STRING) in /home/xxxxxxxx/public_html/fwrite.php on line 5
*/
?>

I have stripped the program down to almost nothing, still getting the error (shown at bottom of code) whenever I execute the program.我已经将程序精简到几乎没有,但每次执行程序时仍然会出现错误(显示在代码底部)。

The most probable cause is non-breaking space instead of a normal space somewhere in your code.最可能的原因是不间断空格而不是代码中某处的正常空格。 Which doesn't allow to parse it properly.这不允许正确解析它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM