$tpl = preg_replace(
['/\s*([,;:\{\}])\s*/', '/[\t\n\r]/', '/\/\*.+?\*\//'],
['\\1', '', ''],
$tpl
);
准备使用preg_replace_callback替换掉preg_replace函数.目前只会使用preg_replace_callback替换字符串,该如何替换上述数组.
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
数组替换preg_replace_callback没有preg_replace那么好用,但是也不是不能实现
http://php.net/manual/zh/func...
后来发现使用preg_replace_callback_array来处理这中不统一的替换规则更方便.