strtolower(preg_replace('/((?<=[a-z])(?=[A-Z]))/', '_', 'AbcDef'))
本文介绍了一个PHP中处理字符串的实用技巧,使用preg_replace和strtolower函数组合实现字符串转换,具体为将'AbcDef'这样的驼峰命名转换为'abc_def'格式。
strtolower(preg_replace('/((?<=[a-z])(?=[A-Z]))/', '_', 'AbcDef'))
转载于:https://www.cnblogs.com/pcx105/p/7724386.html
3358
2051

被折叠的 条评论
为什么被折叠?