So, my code is as follows:
$data = file_get_contents("js/plugins.js");
if (isset($_GET['resx'])) {
if (isset($_GET['resy'])) {
$data = str_replace('"Screen Width":"1366","Screen Height":"768"', '"Screen Width":"$resx","Screen Height":"$resy"', $data);
}
}
file_put_contents("js/web_settings.js", $data);
What I am trying to do is define multiple variables in the URL bar and the website will update the file as such. Apparently, it seems to be replacing the string with the variable names itself instead of replacing it with the value of those variables. (So, if resx is 1280, 1366 becomes $resx instead of 1280) Due to the way the game engine works, the quotes need to be there. How do I fix this so it replaces it with the value of those variables?