如何在刀片文件中使用恒定值 - laravel
我想在blade
文件中使用常数值。 我有svg
标签,其中我拥有< path>
标签,其中我想使用常数值。
我在线搜索。我得到了这个解决方案 我得到了这些解决方案。
https:///www.codegrepper.com/code-com/code-com/code-com/code-com/code-com/code-com/code-com/code-com/示例/php/get+常数+值+in+laravel https://stackoverflow.com/a/a/42155879/7290043
如解决方案中所建议的。我创建了一个startants.php
<?php
return [
// -------------- UI Constants
'MAXIMIZE_SQAURE_ICON' => 'M14,15h-4v-2h3v-3h2v4C15,14.6,14.6,15,14,15z M13,3h-3V1h4c0.6,0,1,0.4,1,1v4h-2V3z M6,3H3v3H1V2c0-0.6,0.4-1,1-1h4V3z
M3,13h3v2H2c-0.6,0-1-0.4-1-1v-4h2V13z'
];
我正在尝试使用此maximize_sqaure_icon
value as d
的&lt; path&gt;
刀片文件的标签
<svg width="16" height="16">
<path d="MAXIMIZE_SQAURE_ICON" />
</svg>
我还尝试了&lt;路径d = config :: get('constants.admin_name') /&gt; < /code>
我不确定如何正确访问它。我是拉维尔(Laravel)的新手。
I want to use constant value inside blade
file.
I have svg
tag in which I have<path>
tag in which I want to use constant value.
I searched it online. I got this solution
I got these solutions.
https://www.codegrepper.com/code-examples/php/get+constant+value+in+laravel
https://stackoverflow.com/a/42155879/7290043
As suggested in the solution. I created a constants.php
<?php
return [
// -------------- UI Constants
'MAXIMIZE_SQAURE_ICON' => 'M14,15h-4v-2h3v-3h2v4C15,14.6,14.6,15,14,15z M13,3h-3V1h4c0.6,0,1,0.4,1,1v4h-2V3z M6,3H3v3H1V2c0-0.6,0.4-1,1-1h4V3z
M3,13h3v2H2c-0.6,0-1-0.4-1-1v-4h2V13z'
];
I'm trying to use this MAXIMIZE_SQAURE_ICON
value as d
of <path>
tag of blade file
<svg width="16" height="16">
<path d="MAXIMIZE_SQAURE_ICON" />
</svg>
I also tried <path d = Config::get('constants.ADMIN_NAME') />
I'm not sure how to access it properly. I'm new to laravel.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您只需要像这样调用刀片文件中的卷曲括号中的常量:
You just need to call the constant in curly braces in your blade file like this: