是否可以在laravel中像这样更改字符串:
"这是字符串", "这是细绳"?
在laravel文档中。我只发现了这个:
$snake = snake_case('fooBar');foo_bar
//
非常感谢您的帮助
如果你想在Laravel中这样做,你可以调用:
Str::slug('This Is String');
更多信息请访问API: http://laravel.com/api/source-class-Illuminate.Support.Str.html#247-270
我不知道Laravel,但你可以试试这个:
<?php
$string = "This Is String"
$string = strtolower(str_replace(" ", "-", $string)); // "this-is-string"
?>
try this:
return Str::slug('This Is String');
//这是细绳
doc: http://three.laravel.com/docs/strings/http://laravel.com/api/source-class-Illuminate.Support.Str.html#247-270