首页 > 解决方案 > 将
标签添加到php

问题描述

我想通过 Laravel 发送通知,一切正常,但我有一些风格问题,

如何将<br>标签添加到这一行php

public function toTelegram($product)
    {
     return TelegramMessage::create()
         ->to('@xxxxx')
         ->content('New Product is here ' .$product->title) //need br here
         ->button('Shop Now', 'http://domain.co/store/'. $product->slug);
    }

当用户收到通知时,我想$product->title在新行中显示。

PS:我试过了\n\r\n<br>没有任何改变。

这是现在的样子:

屏幕 1

标签: phplaravel

解决方案


我认为您应该将这一行更改为此
->content('New Product is here ' .$product->title) //need br here

->content('New Product is here '.'<br>'.$product->title)
尝试将 < br> 替换为 \n ...


推荐阅读