如何在Laravel中使用str_replace [英] How to use str_replace in laravel

查看:208
本文介绍了如何在Laravel中使用str_replace的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在laravel框架中使用php函数str_replace.

我在表列名称上的数组键名,因此键具有"_",例如first_name,last_name等.我想在刀片文件中删除这些"_".我的要求是.blade.php文件中的字符串替换.

My array key names on table columns name so keys have '_' like first_name, last_name etc. i want to remove these '_' in blade file. my requirement is string replace in .blade.php file.

我正在尝试此php代码,但它没有用.

i am trying this php code but it's useless.

<th>{{str_replace('_', ' ', $str)}}</th>

谢谢

推荐答案

您可以在.blade.php文件中使用php代码

You can use php code in .blade.php file

尝试这样

<th> <?=str_replace('_', ' ', $str)?> </th>

这篇关于如何在Laravel中使用str_replace的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆