PHP sprintf转义%
我想要以下输出:
将从您的充值帐户中扣除27.59欧元的50%。
当我做这样的事情时:
$variablesArray[0] = '€';$variablesArray[1] = 27.59;
$stringWithVariables = 'About to deduct 50% of %s %s from your Top-Up account.';
echo vsprintf($stringWithVariables, $variablesArray);
但这给了我这个错误,vsprintf() [function.vsprintf]: Too few arguments in
...因为它也考虑使用%
in 50%
进行替换。我该如何逃脱?
回答:
与另一个转义%
:
$stringWithVariables = 'About to deduct 50%% of %s %s from your Top-Up account.';
以上是 PHP sprintf转义% 的全部内容, 来源链接: utcz.com/qa/409334.html