A-A+
php 5.x 版本preg_replace 转换为 php 7.x 版本preg_replace_callback

【注意:此文章为博主原创文章!转载需注意,请带原文链接,至少也要是txt格式!】
php 5.x 版本preg_replace 源代码:
1 2 3 4 5 6 7 | /* replace special blocks by "{php}" */ $source_content = preg_replace($search.'e', "'" . $this->_quote_replace($this->left_delimiter) . 'php' . "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'" . $this->_quote_replace($this->right_delimiter) . "'" , $source_content); |
转换为php 7.x 版本preg_replace_callback
1 2 3 4 5 6 7 | /* replace special blocks by "{php}" */ $source_content = preg_replace_callback($search, create_function ('$matches', "return '" . $this->_quote_replace($this->left_delimiter) . 'php' . "' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'" . $this->_quote_replace($this->right_delimiter) . "';") , $source_content); |
最后说一句 smarty 更新了。
https://github.com/simpleinvoices/simpleinvoices/tree/master/library/smarty
布施恩德可便相知重
微信扫一扫打赏
支付宝扫一扫打赏