php - 如何在 Laravel 中使用条带格式化 URL?
问题描述
我想从此更改 URL 格式:
http://127.0.0.1:8000/news/4123/news today in the sea
至 :
http://127.0.0.1:8000/news/4123/news-today-in-the-sea
如何在 Laravel 中更改它?
解决方案
laravel中有一个助手str_slug()
$string = str_slug("news today in the sea", "-");
//$string : "news-today-in-the-sea"
推荐阅读
- java - 为什么 Math.Pow(x,y) 使用 double 而不是 long?
- php - 无法将 Visual Studio 代码连接到 PHP
- c++ - Windows:隐式链接位于不同文件夹中的 DLL
- angular - 从异步函数更新 Angular 视图
- tensorflow - TensorflowJS:如何在 TFJS 中重置预训练模型的输入/输出形状
- python - 更新 tkinter 接口上的当前值
- java - 来自主查询的构造函数中的多个子查询会中断 Hibernate 转换
- laravel - 未定义变量:user.blade.php 中的类别
- reactjs - 反应原生 mapbox 设置唯一值来旋转 SymbolLayer
- c++ - 我在读取文件时遇到问题