文件写入脚本只创建一个名为“0”的空文件

File-writing script just creates an empty file named "0"

当我使用 PHP、

写入文件时
<?php
    header('Access-Control-Allow-Headers: *');
    $texttowrite = $_POST['articletext'];
    $title = $_POST['title'];
    $name = $_POST['name'];
    // Illegal characters on Unix and Linux or any *nix server
    $illegal = array(" ", "?", "/", "\", "*", "|", "<", ">", '"');
    // Legal characters
    $legal = array("-", "_", "_", "_", "_", "_", "_", "_", "_");
    // Replace it!
    $newtitle = str_replace($illegal, $legal, $title);
    $newname = str_replace($illegal, $legal, $name);
    $filename = "content/" + $newtitle + "-" + $newname;
    $myfile = fopen($filename, "w") or die("Unable to open file!");
    fwrite($myfile, $texttowrite);
?>

note: this program is supposed to read output and a file name from POST form data and write it to a server.

它只是在服务器文件系统的根目录中创建一个名为“0”的文件。有什么问题吗?

编译器未生成任何错误。

PHP 中的字符串连接是 .,而不是 +