php的sprintf函数笔记

sprintf这个函数,特殊写法写起来蛮奇怪,做个笔记

%4$s这个

$a = sprintf('select %4$s,count(id) as cnt from %s c left join %s s on c.id = s.id where %s and s.%4$s != 0 group by %4$s', 'aa', 'aa222222', 'aa222222433333333', 'aa22222255555');

echo $a;

//select aa22222255555,count(id) as cnt from aa c left join aa222222 s on c.id = s.id where aa222222433333333 and s.aa22222255555 != 0 group by aa22222255555

含义:大致是调整变量的实际位置

猜你喜欢

转载自blog.csdn.net/weixin_38230961/article/details/112847070
今日推荐