Join查询中表名替换:
$str = 'left join aaaaa on a.id=b.id left join bbbb as b a.id=b.id';
$tablePre = 'tutiantian_';
echo preg_replace('/(left join|right join|inner join)\s+(\w+)\s+/i'," $1 {$tablePre}$2 ",$str);
Join查询中表名替换:
$str = 'left join aaaaa on a.id=b.id left join bbbb as b a.id=b.id';
$tablePre = 'tutiantian_';
echo preg_replace('/(left join|right join|inner join)\s+(\w+)\s+/i'," $1 {$tablePre}$2 ",$str);