samedi 13 mars 2021

How would one sent a PHP array to email/sms and maintain the format of the text in the array?

I have this array

array:8 [▼
  0 => "http://bheng.test/baby/Norden?code=rithys4k"
  1 => "http://bheng.test/baby/Mila?code=soriy4"
  2 => "http://bheng.test/baby/tyty?code="
  3 => "http://bheng.test/baby/?code="
  4 => "http://bheng.test/baby/Beverly Hills?code="
  5 => "http://bheng.test/baby/hunter?code=99"
  6 => "http://bheng.test/baby/Lee?code=yoloMVIS"
  7 => "http://bheng.test/baby/Cheat?code="
]

I'm trying to sent this list off via SMS

I did this : adding my <pre> tag around my print_r

public function report(){


    $babies = Baby::all(); 
    $adminLinks = [];
    foreach ($babies as $i => $baby) {
        $adminLinks[$i] = env('APP_URL').'/baby/'.$baby->babyName.'?code='.$baby->readOnlyCode;
        
    }

    // dd($adminLinks);

    $message = '<pre>'.print_r($adminLinks).'</pre>'; ///SEND DATA 

    $sent = Mail::raw($message, function ($message) {
        $message->from(env('MAIL_FROM'));
        $message->to(env('LONG_PHONE'))->subject('đŸŒ >>');
    });

    if($sent) {
        return "SENT"; 
    }

}

I kept getting

enter image description here


If I don't so print_r(), I will get get

enter image description here


If I do json_encode, I'm closed. BUT it messed up my format.

enter image description here

How would one sent an array to email/sms and maintain the format of the text in the array ?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2OQTw9W
via IFTTT

Aucun commentaire:

Enregistrer un commentaire