我如何回应PHP的json字符串?

i need to echo $account into $url so that the url/path is whatever i get from $account plus the extension json. I can't figure it out with the quotes. i tried single and double quotes but no luck. any ideas?

<?php 
$account = $_POST['account'];
$url = 'echo $account.json'; //
$content = file_get_contents($url);
$json = json_decode($content, true);
?>

Like this?

<?php 
$account = $_POST['account'];
$url = $account. '.json'; //
$content = file_get_contents($url);
$json = json_decode($content, true);
?>

the . operator is used for string concatenation in php. This means take the value of $account and append the string .json to the end, and store that in the variable $url. The rest of the code looks all right from there. There are a few other ways to do this as well with strings in php, but I find this one simplest.

The documentation on strings goes into detail on how to format strings. You might want to try using curly braces ({}) around your variable as well to delineate where the identifier ends.

$url = "{$account}.json"

You can do this as this

$account = $_POST['account'];
$content = file_get_contents($account.'.json');
$json = json_decode($content, true);

Need I remind you how, vulnerable your codes are to injection?