version: "3"
networks:
default:
driver: bridge
driver_opts:
com.docker.network.driver.mtu: 1420
{
"mtu": 1420
}
systemctl restart docker
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<title>Document</title>
</head>
<body>
<div>
<form action="">
<input type="text" name="name">
<input type="text" name="phone">
<input type="hidden" name="first" value="first">
<input type="submit" name="first">
</form>
</div>
<div>
<form action="">
<input type="text" name="name">
<input type="text" name="email">
<input type="hidden" name="second" value="second">
<input type="submit" name="second">
</form>
</div>
<div>
<form action="">
<input type="text" name="name">
<textarea name="textarea"></textarea>
<input type="hidden" name="third" value="third">
<input type="submit" name="third">
</form>
</div>
<script type="text/javascript">
$(document).ready(function(){
$("form").on("submit", function(e){
e.preventDefault()
var data = $(this).serialize()
$.ajax({
url: 'ajax.php',
method: 'POST',
data: data,
success: function(response){
console.log(response)
var answer = jQuery.parseJSON(response);
if(answer.type === 'success'){
alert(answer.text)
}
if(answer.type === 'error'){
alert(answer.text)
}
}
})
})
})
</script>
</body>
</html>
<?php
if(isset($_POST)){
if(isset($_POST['first'])){
if(!empty($_POST['name'])){
$answer = ['type' => 'success', 'text' => 'Отправлена форма First'];
}else{
$answer = ['type' => 'error', 'text' => 'Заполните поле "name" в форме First'];
}
}
if(isset($_POST['second'])){
$answer = ['type' => 'success', 'text' => 'Отправлена форма Second'];
}
if(isset($_POST['third'])){
$answer = ['type' => 'success', 'text' => 'Отправлена форма Third'];
}
echo json_encode($answer);
}
?>
class DefaultController extends Controller
{
public $test;
public function actionIndex()
{
$this->test = 'test';
/* остальной код метода */
}
}
<?= Yii::$app->controller->view->context->test ?>
RewriteEngine On
RewriteRule ^(frontend|backend)/web/ - [L]
RewriteCond %{REQUEST_URI} ^/(admin)
RewriteRule ^admin(\/?.*)$ backend/web/$1 [L]
RewriteCond %{REQUEST_URI} ^/
RewriteRule ^(\/?.*)$ frontend/web/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
'baseUrl' => '/admin'
http://site.com
попадёте на frontend, а по адресу http://site.com/admin
- в админку.http://site.com/subsite
.RewriteEngine On
RewriteRule ^(frontend|backend)/web/ - [L]
RewriteCond %{REQUEST_URI} ^/(subsite/admin)
RewriteRule ^admin(/.*)?$ backend/web/$1 [L]
RewriteCond %{REQUEST_URI} ^/(subsite)
RewriteRule ^(.*)$ frontend/web/$1 [L]
$baseUrl = str_replace('/backend/web', '', (new yii\web\Request)->getBaseUrl());
'baseUrl' => $baseUrl . '/admin'
'default/<id:\d+>/brand-<brand:\d+>' => 'default/index',
'default/<id:\d+>' => 'default/index',
'default' => 'default/index',
echo Html::a('test', ['default/index', 'id' => $id, 'brand' => $brand])
echo Html::a('test', ['default/index', 'id' => $id])
echo Html::a('test', ['default/index'])
http://site.loc/default/index/3/brand-2
http://site.loc/default/index/3
http://site.loc/default/
Я спрашиваю как изменить
if (!empty($file['name'][0])) {
if (!empty($file['name'][$k])) {
SkillsChecked::loadMultiple($sk_ch, Yii::$app->request->post(), '')
Model::loadMultiple($sk_ch, Yii::$app->request->post())
SkillsChecked::validateMultiple($settings))
Model::validateMultiple($sk_ch))
['publish_at', 'datetime', 'timestampAttribute' => 'publish_at', 'format' => 'php:Y-m-d H:i'],
public function contact($email)
{
echo $this->publish_at; // 2020-06-12 14:45.
if ($this->validate()) {
echo $this->publish_at; // 1591962300
exit();
}
return false;
}
[
'template' => '{view}',
'buttons' => [
'view' => function($url, $model, $key){
return Html::a($model->title, $url)
}
]
]
[
'attribute' => 'title',
'value' => function($model){
return Html::a($model->title, ['controller/action', 'id' => $model->id])
}
]
// GirdView column
[
'attribute' => 'status',
'contentOptions' => function($model, $key, $index, $column){
return [
'class' => 'status-column',
'style' => 'cursor:pointer',
'id' => $key,
'onclick' => '
$.ajax({
url: "' . Url::toRoute('/ajax/update-status-mark') . '",
method: "POST",
data: {id: ' . $key . ', status: ' . $model->status . '},
success: function(data){
if(data == 0){
$("td#' . $key . ' span").removeClass("label-success").addClass("label label-danger").text("Blocked")
$("tr[data-key=' . $key . ']").removeAttr("style")
}
else{
$("td#' . $key . ' span").removeClass("label-danger").addClass("label label-success").text("Active")
$("tr[data-key=' . $key . ']").css("backgroundColor","rgb(226, 243, 227)")
}
}
})
'
];
},
]
// Controller action
public function actionUpdateStatusMark($id)
{
$model = $this->findModel($id);
$model->status = $model->status == 0 ? 1 : 0;
$model->save(false,['status']);
return $model->status;
}
aptitude search curl
i A php-curl - CURL module for PHP [default]
v php-curl:i386 -
p php5.6-curl - CURL module for PHP
p php5.6-curl:i386 - CURL module for PHP
p php7.0-curl - CURL module for PHP
p php7.0-curl:i386 - CURL module for PHP
p php7.1-curl - CURL module for PHP
p php7.1-curl:i386 - CURL module for PHP
i A php7.2-curl - CURL module for PHP
p php7.2-curl:i386 - CURL module for PHP
p php7.3-curl - CURL module for PHP
p php7.3-curl:i386 - CURL module for PHP
i php7.4-curl - CURL module for PHP
p php7.4-curl:i386
sudo apt-get install php7.4-curl
echo ColorPicker::widget([
'name' => 'Test',
'value' => '#CCCCCC',
'options' => [
'onchange' => '
console.log($(this).val())
// ВОТ ТУТ ДЕЛАЙТЕ ЧТО ХОТИТЕ, ХОТЬ ПО AJAX ОТПРАВЛЯЙТЕ, ХОТЬ КУДА ПРИСВАИВАЙТЕ.
'
]
]);
$request = Model::find();
if(...){
$request->andWhere(...);
}
$query = $request->all(); // or one()