讨论数量:
use Illuminate\Support\Str;
$converted = Str::snake('fooBar');
// foo_bar
$converted = Str::studly('foo_bar');
// FooBar
use Illuminate\Support\Str;
$converted = Str::snake('fooBar');
// foo_bar
$converted = Str::studly('foo_bar');
// FooBar
分享一个自用转换(蛇形、驼峰,单复数等)类 - app/Support/Inflector.php
Inflector::pluralize(string $str);
Inflector::singularize(string $str);
Inflector::camelize(string $str);
Inflector::variable(string $str);
Inflector::classify(string $str);
Inflector::tableize(string $str);
Inflector::underscore(string $str);
Inflector::dasherize(string $str);
Inflector::humanize(string $str);
推荐文章: