我有一些像这样的PHP代码:
echo sprintf('<script type="text/javascript" language="javascript">
var UserId = "%s";
var UserNickname = "%s";
var UserEmailAddress = "%s";
var EmailVerified = "%s";
var Signature = "'.base64_encode(hash_hmac('sha1', $userid . $user . $_SESSION['userinfo']['mail'] . "true", 'password', true)).'";
</script>', $userid, $user, $_SESSION['userinfo']['mail'], "true");
我想知道我是否可以某种方式使用 sprintf 来摆脱我的变量的重复提及以简化维护代码?