我已对图像进行了验证,但它无法正常工作,返回页面并输入为空 代码中的任何错误?
$to = 'sufyan.viftech@gmail.com';
$subject = 'subject';
$body = '<table border="0" cellpadding="0" cellspacing="0" width="100%" class="m_5364616749455967748m_-8867064849319555428mcnBoxedTextBlock" style="min-width:100%">
<tbody class="m_5364616749455967748m_-8867064849319555428mcnBoxedTextBlockOuter">
<tr>
<td valign="top" class="m_5364616749455967748m_-8867064849319555428mcnBoxedTextBlockInner">
<table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%" class="m_5364616749455967748m_-8867064849319555428mcnBoxedTextContentContainer">
<tbody><tr>
<td style="padding-top:9px;padding-left:18px;padding-bottom:9px;padding-right:18px">
<table border="0" cellspacing="0" class="m_5364616749455967748m_-8867064849319555428mcnTextContentContainer" width="100%" style="width:80%!important;background-color:#f7f7f7;margin:auto;max-width:400px;border:1px solid #d9d9d9">
<tbody style="width:80%"><tr style="width:80%">
<td valign="top" class="m_5364616749455967748m_-8867064849319555428mcnTextContent" style="padding:18px;color:#8a8b99;font-family:Helvetica;font-size:14px;font-weight:normal;line-height:125%;text-align:center">
<p style="color:#8a8b99;font-family:Helvetica;font-size:14px;font-weight:normal;line-height:125%;text-align:center;max-width:400px;word-wrap:break-word"><strong>".$msg."</strong></p>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table>';
$body .= '
<p style="font-size:13px;line-height:125%;text-align:center"><span style="font-size:13px"><span style="font-family:arial,helvetica neue,helvetica,sans-serif">Your private key gives access to your Mobilink account. <strong><span style="color:#463ce6">Save it! </span></strong><br>
This is the <span style="color:#463ce6"><strong>most secure method</strong></span> of saving your data.</span></span></p>
<p style="font-size:13px;line-height:125%;text-align:center"><span style="font-size:13px"><span style="font-family:arial,helvetica neue,helvetica,sans-serif">You account id: <strong><span style="color:#463ce6">".$userid."</span></strong></span></span></p>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table>
//code paste
</td>
</tr>
<tr>
<td valign="top" id="m_5364616749455967748m_-8867064849319555428templateBody"><table border="0" cellpadding="0" cellspacing="0" width="100%" class="m_5364616749455967748m_-8867064849319555428mcnButtonBlock" style="min-width:100%">
<tbody class="m_5364616749455967748m_-8867064849319555428mcnButtonBlockOuter">
<tr>
<td style="padding-top:18px;padding-right:18px;padding-bottom:18px;padding-left:18px" valign="top" align="center" class="m_5364616749455967748m_-8867064849319555428mcnButtonBlockInner">
<table border="0" cellpadding="0" cellspacing="0" class="m_5364616749455967748m_-8867064849319555428mcnButtonContentContainer" style="border-collapse:separate!important;border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-right-radius:0px;border-bottom-left-radius:0px;background-color:#463ce6">
<tbody>
<tr>
<td align="center" valign="middle" class="m_5364616749455967748m_-8867064849319555428mcnButtonContent" style="font-family:Arial;font-size:14px;background-color: #3c6f9b;padding:15px">
<a class="m_5364616749455967748m_-8867064849319555428mcnButton" title="LOGIN INTO MOBILINK" href="http://mobilink.io/dashboard/signin.php" style="font-weight:bold;letter-spacing:normal;line-height:100%;text-align:center;text-decoration:none;color:#ffffff" target="_blank" data-saferedirecturl="">LOGIN INTO MOBILINK</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="m_5364616749455967748m_-8867064849319555428mcnDividerBlock" style="min-width:100%">
<tbody class="m_5364616749455967748m_-8867064849319555428mcnDividerBlockOuter">
<tr>
<td class="m_5364616749455967748m_-8867064849319555428mcnDividerBlockInner" style="min-width:100%;padding:18px">
<table class="m_5364616749455967748m_-8867064849319555428mcnDividerContent" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%;border-top-width:1px;border-top-style:solid;border-top-color:#eaeaea">
<tbody><tr>
<td>
<span></span>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="m_5364616749455967748m_-8867064849319555428mcnImageBlock" style="min-width:100%">
<tbody class="m_5364616749455967748m_-8867064849319555428mcnImageBlockOuter">
<tr>
<td valign="top" style="padding:0px" class="m_5364616749455967748m_-8867064849319555428mcnImageBlockInner">
<table align="left" width="100%" border="0" cellpadding="0" cellspacing="0" class="m_5364616749455967748m_-8867064849319555428mcnImageContentContainer" style="min-width:100%">
<tbody><tr>
<td class="m_5364616749455967748m_-8867064849319555428mcnImageContent" valign="top" style="padding-right:0px;padding-left:0px;padding-top:0;padding-bottom:0;text-align:center">
<img align="center" alt="" src="https://ci3.googleusercontent.com/proxy/FmUNPqCu--DZltz4pKkxYSOKDUUYizUcG47lTfbWIVdRl9OybimOALOgxUg0MUf3ujPgQrBrXV6rRwY9WbMcN-c=s0-d-e1-ft#https://static.mirocana.com/img/warning.png" width="60" style="max-width:60px;padding-bottom:0;display:inline!important;vertical-align:bottom" class="m_5364616749455967748m_-8867064849319555428mcnImage CToWUd">
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="m_5364616749455967748m_-8867064849319555428mcnTextBlock" style="min-width:100%">
<tbody class="m_5364616749455967748m_-8867064849319555428mcnTextBlockOuter">
<tr>
<td valign="top" class="m_5364616749455967748m_-8867064849319555428mcnTextBlockInner" style="padding-top:9px">
<table align="left" border="0" cellpadding="0" cellspacing="0" style="max-width:100%;min-width:100%" width="100%" class="m_5364616749455967748m_-8867064849319555428mcnTextContentContainer">
<tbody><tr>
<td valign="top" class="m_5364616749455967748m_-8867064849319555428mcnTextContent" style="padding:0px 18px 9px;font-size:12px;text-align:center">
<img src="https://mobilink.io/dashboard/images/logo_blue.png" width=45%>
<p style="font-size:12px;text-align:center">THOSE WHO HAVE THIS PRIVATE KEY HAVE ACCESS TO YOUR ACCOUNT<br>
IF YOU LOSE YOUR PRIVATE KEY YOU WILL NOT BE ABLE TO RESTORE YOUR ACCOUNT</p>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table></td>
</tr>
</tbody></table>';
// $msg = trim($body);
$headers = 'From: sufyan.viftech@gmail.com' . "\r\n" ;
$headers .='Reply-To: '. $to . "\r\n" ;
$headers .='X-Mailer: PHP/' . phpversion();
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
if(mail($to, $subject,$body,$headers)) {
echo('<br>'."Email Sent ;D ".'</br>');
}
else
{
echo("<p>Email Message delivery failed...</p>");
}
答案 0 :(得分:0)
如果输入为空,请尝试$request->all();
检查此命令是否返回您的表单值。如果您能够看到表单结果,那么您可以继续,否则您必须检查表单中的操作网址是否正确。
对于文件上传,请不要忘记在表单的开头标记中添加enctype="multipart/form-data"
。
而不是使用Input::get('title')
为什么不使用$request->get('title')
更清洁的方式呢?
嗯,您不必在验证中使用图片,mimes
即可:
请更改您的以下代码:
$this->validate($request, [
'image' => 'image|mimes:jpeg,jpg,png,gif',
]);
进入这个:
$this->validate($request, [
'image' => ''mimes:jpeg,jpg,png,gif',
]);
这应该适合您,有关更多信息,请访问此网址https://laravel.com/docs/5.5/validation#rule-mimetypes有关laravel mime类型验证的官方文档。
快乐的编码!
答案 1 :(得分:0)
if(Input::hasFile('image')){
$this->validate($request, [
'image.*' => 'mimes:jpeg,jpg,png,gif',
],['image.*' => 'الملف يجب ان يكون من نوع صورة']);
foreach ($request->file('image') as $file){
$name = $file->getClientOriginalName();
$picture = date('His').$name;
$myimg = $file->move('uploads',$picture);
$Photos = new Photos;
$Photos->id_ads = $ADS->id;
$Photos->type = 1;
$Photos->photo = $myimg;
$Photos->save();
}
}