使用PHP从JSON文件中删除所有引号

I want to remove all double quotes from a JSON file using PHP.

The following code outputs all the variables to a JSON file named example.json:

$var_geoJSON = 'var geoJSON = ';
file_put_contents('jsonfun.json', $var_geoJSON);
file_put_contents('jsonfun.json', json_encode($geojson, JSON_NUMERIC_CHECK), FILE_APPEND);

I was trying to get it to output something like this:

var geoJSON = {...}

Yet it outputs something like this:

"var geoJSON = " {...}

I am currently working with geoJSON to output to the open source leaflet.js mapping library, and the syntax requires that I have var geoJson = {...} instead of having "var geoJSON = "{...}.

I have tried using the PHP command preg_replace() replacing all the "" with spaces, yet that still didn't work and it outputted the same thing with the double quotes.

Any ideas?

Just use str_replace function http://www.w3schools.com/php/func_string_str_replace.asp example: $result = str_replace('"', '', $json)