function numbers() {
$a = array();
for($i = 1; $i <= 10; $i++) {
$a[] = $i;
}
return $a;
}
print_r(numbers());
function () {
return['1 2 3 4 5 6 7 8 9 10'];
}
<input type="hidden" value="<?php the_permalink(); ?>" name="url">
<input type="hidden" value="" name="url" class="url">
document.querySelector('.url').value = location.href;
$data = $_POST;
if ($data['name']) {
$message = '<html><body>';
$message .= "<table>";
foreach ($data as $key => $value) {
$message .= "<tr>";
$message .= "<td>";
$message .= "<strong> $key: </strong>";
$message .= "</td>";
$message .= "<td style='padding-left:12px;'>";
$message .= " htmlspecialchars(trim($value))";
$message .= "</td>";
$message .= "</tr>";
}
$message .= "</table><br><br>";
$message .= "</body></html>";
require dirname(__DIR__).'/Exception.php';
require dirname(__DIR__).'/PHPmailer.php';
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->setFrom('no-reply@example.com', 'Mail title');
$mail->addAddress('John@mail.ru', 'John Doe');
$mail->Subject = $subject;
// Прикрепление файлов
if (isset($_FILES['photo']) &&
$_FILES['photo']['error'] == UPLOAD_ERR_OK) {
for($i=0;$i<count($_FILES['photo']['tmp_name']);$i++)
{
$uploadfile = tempnam(sys_get_temp_dir(), sha1($_FILES['photo']['name'][$i]));
$filename =$_FILES['photo']['name'][$i];
if (move_uploaded_file($_FILES['photo']['tmp_name'][$i], $uploadfile)) {
$mail->addAttachment($uploadfile, $filename);
}
}
}
$mail->msgHTML($message);
$r = $mail->send();
if ($r) {
$answer = 'success';
} else {
$answer = 'failure';
}
die($answer);
}