我有一个文本区域标签,我希望它有一个默认值={{“示例文本区域”}}
我正在尝试这样做:
<textarea name="" id="" cols="30" rows="10">{{"example text area"}}</textarea>,所以输出值正好是{{“示例文本区”}}
但是上面的代码只会打印example text area
我尝试了{!!'{{"tre"}}'!!}和上面相同的响应,我也尝试了{!!'{{"example text area"}}'!!},它输出<?php echo e("example text area"); ?>
那么该怎么做呢?
发布于 2020-03-16 16:47:17
一种方法是在刀片中创建一个变量,并在必要时回显该变量,如:
//test.blade.php
@php
$placeholder = "{{example text area}}";
@endphp
<textarea name="" id="" cols="30" rows="10">{{$placeholder}}</textarea>简单的方法是回显必要的值,如下所示
<textarea name="" id="" cols="30" rows="10"><?php echo "{{example text area}}" ?></textarea>如果您的Laravel版本高于5.1,则可以使用
<textarea name="" id="" cols="30" rows="10">@{{"gitHub_validation"|translate}}</textarea>发布于 2020-03-16 16:48:36
你为什么要这么做?如果文本不是来自crontroller (变量),您可以键入您想要的内容。
<textarea class="form-control">my default text</textarea>或者,如果重要,使用占位符:
<textarea class="form-control" placeholder="bla"></textarea>发布于 2020-03-16 17:25:25
你能试试这样的东西吗?如果是静态值,则可以将其打印出来。
<textarea name="" id="" cols="30" rows="10"><?php echo '{{"gitHub_validation"|translate}}' ?></textarea>https://stackoverflow.com/questions/60702708
复制相似问题