【发布时间】:2018-10-11 18:09:25
【问题描述】:
我正在 Laravel 中创建一个 foodlog 应用程序,有关如何制作食谱的说明存储在数据库中的逗号分隔列表中,如下所示:
cook the chicken, add peppers and onions, add sauce, serve with rice
我想让它在我的网站上显示为一个编号列表,例如:
1. cook the chicken
2. add peppers and onions
3. add sauce
4. serve with rice
我目前有字符串出现在“”标签中,但希望将其作为编号列表。有什么想法吗?
info.blade.php
<h1>{{ $recipes->recipe_name }}<h1>
<h2>Ingredients:</h2> <p>{{ $recipes->ingredients}}</p><br>
<h2>How to:</h2> <p>{{ $recipes->description }}</p><br>
RecipesController.php
public function showinfo($id) {
$recipes = Recipes::find($id);
return view('recipes.info', compact('recipes'));
}
看起来像这样:
【问题讨论】:
标签: arrays laravel html-lists