有没有办法自动更改PHP文件?

Is there a way that something can be written with PHP that will make changes to a PHP file?

For example, if I wanted to modify a script (whether it be simply adding a small feature or changing an existing feature), instead of posting a tutorial with a bunch of "Find this:", "Replace with this:" or "Find this:", "After, add this:", could I write a PHP page or something that makes these changes for the user with a simple click?

You just load the file to a variable (as long as your server user has access to write to the file), and alter the variable, then overwrite the file.

$content = file_get_contents('test.php');
$content = preg_replace('/find/', 'replace', $content);
file_put_contents('test.php', $content);
//if you need to append to the file, use this flag
//warning: the default (no flag) in third parameter is to overwrite the entire file.
file_put_contents('test.php', $content, FILE_APPEND);

It's just like editing any other file. If you need to loop through the lines, this function is more useful:

$content = file('test.php');
$result  = '';
foreach($content as $line) {
    if(preg_match('/find/', $line) {
        $result .= $replacement;
    } else {
        $result .= $line;
    }
}
file_put_contents('test.php', $result);

This is just an example, since I don't know exactly how you need to replace things in the file.

U check about git? git push and and git pull, maybe its yout solutions... whit 2 click (if u work with Graphics Interfaces) or 2 comands (if you use a terminal)

https://git-scm.com/book/en/v2/Getting-Started-Git-Basics