$str = 'ФИО|Город|Бал';
$excel->getActiveSheet()
->fromArray(
explode('|', $str),
null,
'A1'
);
$('#confirmForm').on('click', function (event) {
$.ajax({
url: '/confirm',
method: 'post',
dataType: 'json',
success: function (data) {
console.log(data);
}
});
});
<?php
session_start();
require_once '/vendor/autoload.php';
$router = new AltoRouter();
$router->map('GET|POST', '/confirm', 'Main::index');
if ($match = $router->match()) {
$path = explode('::', $match['target']);
$controllerName = 'Controller\\' . $path[0];
$controller = new $controllerName;
call_user_func_array([$controller, $path[1]], $match['params']);
} else {
header('Location: /404');
}
<?php
class Main()
{
public function index()
{
$service = new MainService();
$service->saveForm();
json_encode([
'success' => true,
'message' => 'Форма успешно сохранена'
], JSON_UNESCAPED_UNICODE);
}
}
function sendPostToUrl(url, post) {
var form = $('<form/>', {
action: url,
method: 'post',
target: '_blank',
style: {
display: 'none'
}
});
for (key in post) {
if ('message' === key) {
for (i in post[key]) {
form.append($('<input/>', {
type: 'hidden',
name: 'message[]',
value: post[key][i]
}));
}
} else {
form.append($('<input/>', {
type: 'hidden',
name: key,
value: post[key]
}));
}
}
form.submit();
}
$('#learn-more').on('click', function (event) {
event.preventDefault();
sendPostToUrl($(this).attr('href'), data);
});
<?php
namespace View;
use Controller\Error;
use Twig_Environment;
use Twig_Loader_Filesystem;
class TwigView implements IView
{
/**
* @var Twig_Environment
*/
private $twig;
/**
* @var Twig_Loader_Filesystem
*/
private $loader;
/**
* @var string
*/
private $template;
/**
* @var array
*/
private $params;
/**
* @param string $template Имя шаблона
* @param array $params Передаваемые параметры
*/
public function __construct($template, $params)
{
$this->loader = new Twig_Loader_Filesystem(TEMPLATE_DIR);
$this->twig = new Twig_Environment($this->loader);
$this->template = $template;
$this->params = $params;
}
/**
* @return string
*/
public function render()
{
try {
return $this->twig->render($this->template, $this->params);
} catch (\Twig_Error_Loader $e) {
$error = new Error();
$error->index404();
}
}
}
public function index()
{
$this->isAuthorized('users');
try {
$twig = new TwigView('Users/ShowAllUsers.twig',
[
'session' => $_SESSION,
'user' => $this->em->getRepository('Model\User')->getAll()
]
);
print $twig->render();
} catch (DatabaseException $e) {
$error = new Error();
$error->index1010($e->getMessage());
}
}
$date = new \DateTime('now');
echo $date->modify('+1 month')->format('M');
SetFont(string family[,string style[,string size]])
$pdf->SetFont('tahoma', '', 40, '', false);