Kohana 之Inflector
没什么用,这个类
但也有一两个常用点的,记录下
转换首字母大写并合并空格
<?php $str = Inflector::camelize('mother cat'); //"motherCat"
将下滑线,中线转为空格
<?php $str = Inflector::humanize('kittens-are-cats'); // "kittens are cats"
将空格专为下划线
<?php $str = Inflector::underscore('five cats'); // "five_cats";
检查拼写(没什么用)
Inflector::uncountable('fish');// TRUEInflector::uncountable('cat'); // FALSE
在config/inflector.php定义删除复数
echo Inflector::singular('cats'); // "cat"
变为复数
echo Inflector::plural('fish'); // "fish", uncountable


浙公网安备 33010602011771号