phpsprintf関数ノート

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
おすすめ