当前位置:Gxlcms >
PHP教程 >
preg_replace改为preg_replace_callback
preg_replace改为preg_replace_callback
时间:2021-07-01 10:21:17
帮助过:29人阅读
preg_replace改成preg_replace_callback
preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $value);
正则不怎么懂
------解决思路----------------------preg_replace_callback('!s:(\d+):"(.*?)";!s', function($m) { return 's:'.strlen($m[2]).":\"$m[2]\";";}, $value);