我正在尝试在行之间创建一个空间但它不起作用。它假设要进入下一行。它不是打印空间而是打印html标签。有任何线索如何解决这个问题?
SettingController.php
<?php
require 'vendor/autoload.php';
use Mailgun\Mailgun;
$mgClient = new Mailgun('key-41616099');
$domain = "sandbox614b.mailgun.org";
$name = $_POST['name'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$errorMessage = 'There was an error while submitting the form. Please try again later';
// if you are not debugging and don't need error reporting, turn this off by error_reporting(0);
error_reporting(E_ALL & ~E_NOTICE);
try {
if(count($_POST) == 0) {
throw new \Exception('Form is empty');
}
$data = array(
'from' => "Mailgun Sandbox <postmaster@sandbox614b.mailgun.org>",
'to' => "Nami <nami19@gmail.com>",
'subject' => $subject,
'text' => "Congratulations ".$name.",\n".$message
);
# Make the call to the client.
$result = $mgClient->sendMessage($domain, $data);
echo "Form Submit Successfully.";
}
catch (\Exception $e) {
$responseArray = array('type' => 'danger', 'message' => $errorMessage);
}
?>
答案 0 :(得分:2)
搜索如何集成html和php,你会找到很多答案和教程
对于您的代码,您需要为html标记添加""
$content = "Someone purchase your picture"."<br><br>";
foreach ($request->input('pic') as $key => $value) {
$content .= "$key : $value"."<br>";
}
答案 1 :(得分:0)
我实际上是通过电子邮件发送结果,而不是在网络浏览器上打印它们:
public function SendPicture(Request $request)
{
$title = "Picture Purchase";
//$picture = $request->input('pic');
$content = "Someone purchase your picture"."<br><br>";
foreach ($request->input('pic') as $key => $value) {
$content .= "$value".".jpg"."<br>";
}
Mail::send('soulfy.email.purchase', ['title' => $title, 'content' => $content], function ($message) //use ($attach)
{
$message->from('davy.yg1@gmail.com', 'Admin');
$message->to(['davy_yg@yahoo.com', 'stokfoto@soulfy.com']);
//Attach file
//$message->attach($attach);
//Add a subject
$message->subject("Picture Purchase");
});
return redirect('home/setting');
}
电子邮件/ purchase.blade.php
{{$title}}
<br><br>
{{$content}}