Get Mystery Box with random crypto!

For Programming

Telegram kanalining logotibi forprogramming — For Programming F
Telegram kanalining logotibi forprogramming — For Programming
Kanal manzili: @forprogramming
Toifalar: Faktlar
Til: Oʻzbek tili
Obunachilar: 5

Ratings & Reviews

4.00

2 reviews

Reviews can be left only by registered users. All reviews are moderated by admins.

5 stars

1

4 stars

0

3 stars

1

2 stars

0

1 stars

0


Oxirgi xabar 2

2022-06-18 16:11:18 yii2 paginatsiya xatoliklari $disabledListItemSubTagOptions = ['class'=>'page-link']; $linkContainerOptions = ['class' => 'page-item']; $linkOptions = ['class' => 'page-link']; bo`sh massivlarni shular bilan to`ldirish kerak
3 views13:11
Ochish/sharhlash
2022-05-23 04:43:08 https://bbbootstrap.com/snippets/select2-option-cdn-31353331
6 views01:43
Ochish/sharhlash
2022-05-23 04:43:08 https://bbbootstrap.com/snippets/select2-option-cdn-31353331
7 views01:43
Ochish/sharhlash
2022-05-21 09:20:26 Controllerdagi kod

public function actionCreate()
{
if (Yii::$app->request->isAjax) {
$model = new Product();
$product_price = new ProductPrice();
$currency = Currency::find()->where(['status' => Currency::STATUS_ACTIVE])->asArray()->all();
$currency_list = ArrayHelper::map($currency, 'id', 'title');
$category = Category::find()->where(['status' => Category::STATUS_ACTIVE])->asArray()->all();
$category_list = ArrayHelper::map($category, 'id', 'title');
Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
if ($model->load(Yii::$app->request->post())) {
$model->imageFile = $_FILES;
if ($model->Upload() && $model->save()) return ['status' => 'success'];
}
return [
'status' => 'error',
'content' => $this->renderAjax('_form.php',[
'model' => $model,
'product_price' => $product_price,
'currency_list' => $currency_list,
'category_list' => $category_list,
]),
];
}
}


Modeldagi kod


public function getExtension()
{
$extension = explode("/", $this->imageFile['imageFile']['type']);
return $extension[1];
}

public function Upload()
{
if ($this->validate()) {
$file_name = date("Y-m-d")."_".rand(1000, 9999) . '.' . $this->getExtension();
move_uploaded_file($this->imageFile['imageFile']['tmp_name'], 'uploads/images/' . $file_name);
$this->image = $file_name;
return true;
}
return false;
}

Jquerydagi kod


$(document).on("click", "#insert-product-form",function(){
var data = new FormData();
var form = $('#product-create-form').serializeArray();
$.each(form, function (key, input) {
data.append(input.name, input.value);
});
var file_data = $("#product-imagefile").prop("files")[0];
data.append("imageFile", file_data);
console.log(data)
$.ajax({
url: '/product/create',
dataType: 'JSON',
type: 'post',
data: data,
contentType: false,
processData: false,
success: function(response){
if (response.status == 'error') {
$('#exampleModal .modal-title').html('Tovar qo\'shish').css({fontSize: 23})
$('#exampleModal .modal-body').html(response.content)
} else if (response.status == 'success') {
$.pjax.reload('#id-pjax')
$(".close").trigger("click");
}
}
});
});


Ajax orqali file yuklanayotganda file malumotlari kelmay qoladi xattoki $_FILES o'zgaruvchisida ham shuning uchun manashu usulda malumotlarni saqlab olsa bo'ladi
7 views06:20
Ochish/sharhlash
2022-05-07 09:55:41 @ operatori o'zgaruvchi yo'q elon qilinmagan bolsa yoki qiymatlanmagan bo'lsa null qaytaradi
8 views06:55
Ochish/sharhlash
2022-05-07 08:34:30 if (count($array) > 0) {
// simple code...
}

if (!empty($array)) {
// simple code...
}

if (!!$array) {
// recommended code...
}
8 views05:34
Ochish/sharhlash
2022-04-22 05:56:44 $clients = Clients::find()->select('id')->where(['not', ['chat_id' => null]]);
SELECT `id` FROM `clients` WHERE NOT (`chat_id` IS NULL)
SELECT `id` FROM `clients` WHERE `chat_id` IS NOT NULL

hammasi bir hil natija beradi yani chat_id ni null emasligiga tekshiradi
11 views02:56
Ochish/sharhlash
2022-04-14 13:38:42 $output = preg_replace('/(<[^>]+) style=".*?"/i', '', $input);
14 views10:38
Ochish/sharhlash
2022-04-12 10:05:31 yii2da updateAll funksiyasini ifni ichiga olish kerak emas sababi update qilishga malumot topolmasa return false qaytaradi
14 views07:05
Ochish/sharhlash
2022-04-09 02:21:36 ahost da cron yozsa file ochib tashavotudi kamandelani shu kamandaga o'zgartirsela file ochib tashamasakan

wget -O /dev/null -q http://www.example.com/program/timecheck
16 views23:21
Ochish/sharhlash