节点路径驼峰转下划线规则

发布于 2023-05-09 17:28:09

/**

  • 驼峰转下划线规则
  • @param string $node
  • @return string

*/
public static function parseNodeStr($node)
{

$tmp = [];
foreach (explode('/', $node) as $name) {
    $tmp[] = strtolower(trim(preg_replace("/[A-Z]/", "_\\0", $name), "_"));
}
return trim(join('/', $tmp), '/');

}

Bug天天改,头发日日疏,码字不易,如果有帮助到你,就点击"下方感谢"支持一下把.

©声明:本站所有文章,如无特殊说明或标注,均为izhnagbo.cn原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。本文链接 https://www.izhangbo.cn/article/57.html
0 条评论

学习
记录

发布
问题