我不想在命令提示符(php artisan --version)中查看我的Laravel版本,而是在视图中查看.
像这样:
<?php
$laravel_version = /*laravel version check code*/;
?>
Run Code Online (Sandbox Code Playgroud)
在视图中:
{{ $laravel_version }}
Run Code Online (Sandbox Code Playgroud)
有人知道我怎么做吗?也许这是不可能的..?
我可以包含一个.html文件而不是.phpLaravel 4 Blade吗?
我的代码:
@include('emails.templates.file')
//file is email.html
Run Code Online (Sandbox Code Playgroud)
file自动成为.php文件..
dd($result);
结果:
...
+description: "???...????."
+keywords: b"°ó¨Ü¨ü¨ê...ܰ®"
...
Run Code Online (Sandbox Code Playgroud)
+keywords字符串前面有字母 'b',而描述没有那个... 'b' 是什么意思?如果可能,我该如何转换字符串?
顺便说一句,这是如果我 var_dump 关键字的结果:
string(116) "???,????,?,??,??????????,??????????,??,????????,???????,??????:"
我认为它必须对字符集做一些事情,我使用的是 UTF-8。
我使用 Laravel Livewire 制作了一个多文件上传组件。上传完成后我想显示上传的文件而不重新加载页面,如下所示:
<div class="grid grid-flow-col auto-cols-max gap-4 mb-5">
@foreach ($files as $file)
<livewire:file :file="$file"/>
@endforeach
</div>
Run Code Online (Sandbox Code Playgroud)
一次上传一个或多个文件效果很好。但是在上传时,当循环中已经存在文件时,Livewire 会抛出此错误:Uncaught (in promise) TypeError: Cannot read properties of null (reading 'fingerprint')。
经过一些研究后,我得出的结论是,这是因为 Livewire 生成与第一个文件相同的 id:
<div class="grid grid-flow-col auto-cols-max gap-4 mb-5">
<div wire:id="eCHZ9wxyp7nxOC4o5uCC" class="file file-jpeg file-lg">
<!-- content of existing file component -->
</div>
<div wire:id="eCHZ9wxyp7nxOC4o5uCC" class="file file-jpeg file-lg">
<!-- content of new file component, should have Unique wire:id -->
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?
将输入复选框设为Bootstrap glyphicon是否可行?
我想用一个漂亮的Bootstrap glyphicon来组成默认复选框.例如:glyphicon glyphicon-unchecked当检查时:glyphicon glyphicon-check.
我试过这个:
input[type='checkbox'] {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: 400;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
content: "\e157";
}
Run Code Online (Sandbox Code Playgroud)
但什么都没发生..
我不知道这是否可行?