问题
I can not fix this error:
$match[1] = preg_replace('/(?<=^|[a-z])./e', 'strtoupper("\0")', strtolower(trim($match[1])));
How to change it?
回答1:
You should read the manual. The e
modifier is deprecated and will be removed in further versions.
Just use preg_replace_callback
(the message told you..)
$match[1] = preg_replace_callback('/(?<=^|[a-z])./', function($m) {
return strtoupper($m[0]);
}, strtolower(trim($match[1])));
来源:https://stackoverflow.com/questions/33539495/deprecated-preg-replace-the-e-modifier-is-deprecated-use-preg-replace-call