【发布时间】:2019-04-16 01:19:47
【问题描述】:
在我的视图文件中,我尝试添加此代码,但无法调用函数名称'当前价格'
<table>
<tr>
<td>RM {{presentPrice(session()->get('coupon')['name'])}}</td>
</tr>
</table>
这个函数我添加到app/helper路径中
<?php
class helpers{
function presentPrice($price)
{
return money_format('$%i', $price / 100);
}
}
当然我必须运行 composer dump-autoload。但它仍然向我显示未定义的功能
【问题讨论】:
-
你定义了Helper Class
-
我可以知道在哪里定义它吗?因为我认为视图文件不能定义“使用助手”?
-
已回答请过目。