我正在嘗試發送郵件,但它給出了這個錯誤:
The behavior of unparenthesized expressions containing both '.' and ' '/'-' will change in PHP 8: ' '/'-' will take a higher precedence
以下是我在控制器中的代碼
Employee::
where("organization_id", $billing->organization_id)
->permission([ Permission::BILLINGS_FULL_ACCESS ])
->withAllOrganizations()
->get()
->map(function($employee) use($billing) {
Mail::to($employee->work_email)->send(new BillingMail($billing));
});
這是我的郵件代碼:
class BillingMail extends Mailable
{ 使用 Queueable, SerializesModels;
protected $billing;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($billing)
{
$this->billing = $billing->load("organizations", "purchases");
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
$pdf = new BillingPDF();
$pdf->AddSlip($this->billing);
$pdfName = "Invoice-" . $this->billing->id 20220301;
$email = $this->subject("Tankhwa billing")
->view('emails.billing')
->attachData($pdf->Output('S', $pdfName), $pdfName, [
'mime' => 'application/pdf'
])
->with([
"billing" => $this->billing
]);
return $email;
}
我的另一封郵件正在發送,它們使用了相同的邏輯,但是這封郵件出錯了,請有人幫忙。
uj5u.com熱心網友回復:
問題很可能在這一行遇到
$pdfName = "Invoice-" . $this->billing->id 20220301;
嘗試將其更改為
$value = $this->billing->id 20220301;
$pdfName = "Invoice-" . $value;
更多資訊:包含兩個 '.' 的無括號運算式的行為 并且 ' '/'-' 將在 PHP 8 中更改:' '/'-' 將具有更高的優先級
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/461955.html
