Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in

后端 未结 1 1218
遇见更好的自我
遇见更好的自我 2021-01-12 05:23

I need a little help. Because preg_replace is deprecated, I have to convert all my preg_replace to preg_replace_callback...

Wh

相关标签:
1条回答
  • The callback needs to be a function taking one parameter which is an array of matches. You can pass any kind of callback, including an anonymous function.

    $template = preg_replace_callback(
        "#\\[aviable=(.+?)\\](.*?)\\[/aviable\\]#isu",
        function($matches) {
            return $this->check_module($matches[1], $matches[2]);
        },
        $template
    );
    

    (PHP >= 5.4.0 required in order to use $this inside the anonymous function)

    0 讨论(0)
提交回复
热议问题