let $data = new FormData($(this).get(0));
$.ajax({
url: "form.php",
type: "POST",
data: $data,
dataType: "JSON",
processData: false,
contentType: false,
cache: false,
async: true
});
$ololo = (new Ololo())->lol();
$route->onHttpError(
function ($code) {
$instance = "frontend\\controllers\\Home";
switch ($code) {
case 404:
case 405:
header("HTTP/1.1 404 Not Found");
call_user_func([new $instance, "error404"], self::$answer[0][1]);
break;
case 403:
header("HTTP/1.1 403 Forbidden");
call_user_func([new $instance, "error403"], self::$answer[0][1]);
break;
}
}
);
function r_array_search($needle, $haystack, $currentKey = "") {
foreach ($haystack as $key => $value) {
if (is_array($value)) {
$nextKey = r_array_search($needle, $value, $currentKey . "[{$key}]");
if ($nextKey) {
return $nextKey;
}
} else if ($value == $needle) {
return is_numeric($key) ? $currentKey . "[{$key}]" : $currentKey . "['{$key}']";
}
}
return false;
}
$GLOBAL = [
3515 => [
'sub_categories' => [
22916 => [
'sub_categories' => [
33221 => 'test'
]
],
]
],
35215 => [
'sub_categories' => [
221916 => 'test2'
]
],
];
print_r(r_array_search("test", $GLOBAL));
//[3515][sub_categories][22916][sub_categories][33221]
ob_get_contents
в помощь.<table>
<tr>
<td><?= $variable_1 ?></td>
</tr>
<tr>
<td><?= $variable_2 ?></td>
</tr>
</table>
$mail = new PHPMailer();
$variable_1 = "Привет";
$variable_2 = "Чухча";
ob_start();
require_once("template.php");
$body = ob_get_contents();
ob_end_clean();
.....
$mail->Body = $body;
.....