在PHP中使用fwrite但输出奇怪的错误

时间:2022-10-17 16:55:45

I am currently using fwrite, and this is what outputs as an error:

我目前正在使用fwrite,这就是输出错误:

Parse error: syntax error, unexpected ')' in /home/blah/blahblah.com/write/submit.php on line 5

The code goes like this:

代码如下:

$strlen  = strlen ( $_REQUEST["content"] );
$content = $_REQUEST["content"];
$title   = $_REQUEST["title"];
$fp      = fopen( "/home/blah/blahblah.com/write/texts/" . $_POST["title"] . ".txt" , a+ );
fwrite ( $fp , $content , $strlen );
fclose ( $fp );

Please help! I even tried to put in strlen of the text (which is unnecessary) so that it wouldn't expect anything else!

请帮忙!我甚至试图放入文本的strlen(这是不必要的),以便它不会有任何其他期望!

1 个解决方案

#1


2  

The mode needs to be quoted:

该模式需要引用:

$fp = fopen( "/home/blah/blahblah.com/write/texts/" . $_POST["title"] . ".txt" , "a+" );

It's currently being interpreted as an addition, I suspect.

我怀疑它目前被解释为一个补充。

#1


2  

The mode needs to be quoted:

该模式需要引用:

$fp = fopen( "/home/blah/blahblah.com/write/texts/" . $_POST["title"] . ".txt" , "a+" );

It's currently being interpreted as an addition, I suspect.

我怀疑它目前被解释为一个补充。