这可能听起来很奇怪,但这里有.
我喜欢使用这种在php中构建字符串的技术
printf(__('This is %1$s, this is %2$s'), myFunction1(), myFunction2());
Run Code Online (Sandbox Code Playgroud)
显然,无论何时调用函数,这都会直接打印结果,但我想使用这种技术来构建一个字符串,然后在其他地方使用它.
这可能吗?
多谢你们.
Jas*_*son 30
使用sprintf要做到这一点:
$var = sprintf(__('This is %1$s, this is %2$s'), myFunction1(), myFunction2());
Run Code Online (Sandbox Code Playgroud)