print_r(json_decode('[{"reportId":"1","title":"\u041f\u0435\u0440\u0432\u044b\u0439 \u043e\u0442\u0447\u0435\u0442"}]', true))Array
(
[0] => Array
(
[reportId] => 1
[title] => Первый отчет
)
)print_r(json_decode('{"reportId":"1","title":"\u041f\u0435\u0440\u0432\u044b\u0439 \u043e\u0442\u0447\u0435\u0442"}', true))Array
(
[reportId] => 1
[title] => Первый отчет
)
$usersId = Yii::$app->request->post('items', []);$usersId = Yii::$app->request->post('items', []);
$users = Users::findAll($usersId);// для каждой отдельной модели передаёте её массив ошибок
if ($user->hasErrors()) {
$result = [];
$result[Html::getInputId($model, $attribute)] = $model->getErrors();
}
if(isset($_POST['button']) && isset($_POST['checkbox'])){
header('Location: index.php?a=4');
}
if(isset($_GET['a'])){
echo $_GET['a'];
}
crontab -e# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
###
ВОТ ТУТ ПИШИТЕ СВОЁ РАСПИСАНИЕ ДЛЯ CRON
###
* * * * * /home/$user/bash.shcrontab -lcrontab -u UserName -e Вы укажите, от имени какого пользователя будет запускаться cron./var/spool/cron/crontabs. В этой директории будет создан файл с названием по имени пользователя системы. Вот он как раз и редактируется через crontab -e./etc/cron.d. В этом случае надо указывать имя пользователя, от которого будет запускаться задание./etc/cron.daily, /etc/cron.hourly, /etc/cron.monthly, /etc/cron.weekly. В этих директориях можно разместить файлы с заданиями, которые будут запускаться ежедневно, ежечасно, ежемесячно и еженедельно соответственно.
$sendemail = Yii::$app->mailer->compose()
->attach(Yii::getAlias('@root_folder') . '/frontend/uploads/' . $filename . 'Act1.pdf')
->attach(Yii::getAlias('@root_folder') . '/frontend/uploads/' . $filename . 'Act2.pdf')
->attach(Yii::getAlias('@root_folder') . '/frontend/uploads/' . $filename . 'Act3.pdf')
/* остальной код */'@root_folder'? Вам недостаточно стандартных псевдонимов типа @frontend или @webroot?
if ($model->load(Yii::$app->request->post()) && $model->save()) {
$model->passport = UploadedFile::getInstance($model, 'passport');
if($model->passport){
$model->upload();
}
// остальной код действия.
}if ($model->load(Yii::$app->request->post()) && $model->save()) {if ($model->save()) {
Yii::$app->session->setFlash('success', 'Спасибо, мы получили вашу анкету. В скором времени мы с вами свяжемся.');$path = 'img/store/' . $this->passport->baseName . '.' . $this->passport->extension;$path = Yii::getAlias('@web') . 'img/store/' . $this->passport->baseName . '.' . $this->passport->extension;
$answer = [];
if ($filesizeall < 10000000) {
mail($to, $subject, $message, $headers);
// echo 'Ваше сообщение отправлено, спасибо!';
$answer = ['type' => 'success', 'message' => 'Ваше сообщение отправлено, спасибо!']
return json_encode($answer);
}
else {
// echo 'Извините, письмо не отправлено. Размер всех файлов превышает 10 МБ.';
$answer = ['type' => 'error', 'message' => 'Извините, письмо не отправлено. Размер всех файлов превышает 10 МБ.'
return json_encode($answer);
}success: function (data) {
var response = jQuery.parseJSON(data)
if(response.type == 'success'){
alert(response.message);
}
if(response.type == 'error'){
alert(response.message)
}
},
$(function() {
$('#form-data').on('submit', function(e){
e.preventDefault()
var form = $(this); // Предположу, что этот код выполняется в обработчике события 'submit' формы
var data = new FormData(); // Для отправки файлов понадобится объект FormData. Подробнее про него можно прочитать в документации - https://developer.mozilla.org/en-US/docs/Web/API/FormData
// Сбор данных из обычных полей
form.find(':input[name]').not('[type="file"]').each(function() {
var field = $(this);
data.append(field.attr('name'), field.val());
});
// Сбор данных о файле (будет немного отличаться для нескольких файлов)
var filesField = form.find('input[type="file"]');
var fileName = filesField.attr('name');
var file = filesField.prop('files')[0];
data.append(fileName, file) ;
// Отправка данных
var url = 'upload.php';
$.ajax({
url: url,
type: 'POST',
data: data,
contentType: false,
cache: false,
processData:false,
success: function(response) {
console.log(response)
}
});
})
});<form id="form-data" action='#'>
<input type="file" name="test" multiple>
<input type="submit" name='submit' value="Send">
</form>
// в конфигурационном файле
'errorHandler' => [
'errorAction' => 'path/to/error/view',
],// в Вашем файле вывода ошибок
if($exception->statusCode == 404){
$this->title => 'Текст заголовка';
// остальные переменные
}
if($exception->statusCode == 500){
$this->title => 'Текст заголовка';
// остальные переменные
}
// остальной код файла
if($exception->statusCode == 404){$this->title = 'Где-то ошибка';}
/* остальной код файла */
// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://integration.cdek.ru/new_orders.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "xml_request=<?xml version=\"1.0\" encoding=\"UTF-8\" ?><DeliveryRequest Number=\"0000033876WO\" Date=\"2019-04-25T09:09:57\" Account=\"2JewP7QZL***********z8NCbIIbKAw2\" Secure=\"db25*********360f3c64b70\" OrderCount=\"1\"><Order Number=\"123485\" SendCityPostCode=\"350000\" RecCityPostCode=\"350000\" RecipientName=\"Герусов Александр Валерьевич\" RecipientEmail=\"gerusov14@mail.ru\" Phone=\"89615096005\" TariffTypeCode=\"136\" DeliveryRecipientCost=\"137\" DeliveryRecipientVATRate=\"VATX\" DeliveryRecipientVATSum=\"0\" SellerName=\"ИП Волженин Е.Г.\" SellerAddress=\"Ленинградская обл, Всеволожский р-н, Пос. Лесное, дом № 18, кв.6\"><Address PvzCode=\"KSD5\"/><Package Number=\"1\" BarCode=\"krd61927-1\" Weight=\"1000\"><Item WareKey=\"158308\" Cost=\"790\" Payment=\"790\" PaymentVATRate=\"VATX\" PaymentVATSum=\"0\" Weight=\"1000\" Amount=\"1\" Comment=\"Кронштейн для телевизора Ultramounts UM 814F черный\"/></Package></Order></DeliveryRequest>");
curl_setopt($ch, CURLOPT_POST, 1);
$headers = array();
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
<?php echo \yii2mod\comments\widgets\Comment::widget([
'model' => $model,
'dataProviderConfig' => [
'pagination' => [
'pageSize' => 10
],
'sort' => [
'defaultOrder' => ['id' => 'SORT_DESC']
]
]
]); ?>

$message = '';
if(empty($model->getDirtyAttributes())){
// если данные не обновляются, то делайте что Вы желаете)))
}
public function behaviors()
{
return [
[
'class' => SluggableBehavior::class,
//'attribute' => 'title',
'value' => function($event){
return mb_substr($this->title, 0, 5);
}
]
];
}
// $model это Documents
$model->docsign->user->name;<?php foreach($model->docsign as $key => $value): ?>
<?= $value->user->name ?>
<?php endforeach; ?>