我想为我的语言做一个函数
im使用系统的语言形式数据库
有些词我不得不在脚本中重新定义,但我找不到方法
我的代码:
$str = "I'm %s from %s"; // string from database
$tre = 'ex3m,Albania'; // replacements
$tre = explode(',',$tre); // trying to convert replacements to strings separated with commas
sprintf($str, $tre);结果:
Warning: sprintf(): Too few arguments我想要的结果是:
I'm ex3m from Albania
I'm {ex3m} from {Albania}有人能帮帮我吗?
发布于 2012-07-28 22:06:56
sprintf接受可变数量的参数,而不是数组。使用vsprintf
$result = vsprintf($str, $tre);https://stackoverflow.com/questions/11701684
复制相似问题