yii2 get variableni tanimayapdi

0 ovoz
116 marta ko‘rilgan
so‘radi 18 sentabr, 17 alfraganus (515 bal)

yii2 controllerda actionIndex da get variable berilgan va u view chaqirib olingan, lekin muommo sayt osha get variableni tanimayapdi, sayt onlineda hatosiz ishlayapdi, lekin serverdan kochirib localhostga qoyganimda osha
$_get['pro_id'] ni tanime qolyapdi

controllerdagi script:

if(!($_GET['pro_id']> 0)) $_GET['pro_id'] = 1;

switch ($_GET['pro_id']) {
    case 1:
        $query1 = "select T1.dist_dis_id dis_id, T1.dist_name, ifnull(T2.stor_weight, 0) sum_weight from ( select dist_dis_id, dist_name from district_trans where dist_lang_id = 1 order by dist_name) T1 left join (select stor_dis_id, sum(stor_weight) stor_weight from storage where stor_year = ".date("Y")." group by stor_dis_id)T2 on T1.dist_dis_id = T2.stor_dis_id";
        $query2 = "select T0.sect_name, T0.sect_sec_id, ifnull(T1.stor_weight,0) sum_weight from
          (SELECT sect_name, sect_sec_id FROM `section_trans` WHERE sect_lang_id = 1)T0
          left join
          (SELECT stor_sec_id, sum(stor_weight) stor_weight FROM `storage` WHERE stor_year =".date("Y")." group by stor_sec_id)T1
          on
          T0.sect_sec_id = T1.stor_sec_id";
        break;
    case 2:
        $query1 = "select T1.dist_dis_id dis_id, T1.dist_name, ifnull(T2.er_land_area, 0) sum_weight from ( select dist_dis_id, dist_name from district_trans where dist_lang_id = 1 order by dist_name) T1 left join (select er_dis_id, sum(er_land_area) er_land_area from `erf` where er_year = ".date("Y")." group by er_dis_id)T2 on T1.dist_dis_id = T2.er_dis_id";
        $query2 = "select T0.sect_name, T0.sect_sec_id, ifnull(T1.er_land_area,0) sum_weight from
          (SELECT sect_name, sect_sec_id FROM `section_trans` WHERE sect_lang_id = 1)T0
          left join
          (SELECT er_sec_id, sum(er_land_area) er_land_area FROM `erf` WHERE er_year =".date("Y")." group by er_sec_id)T1
          on
          T0.sect_sec_id = T1.er_sec_id";
        break;
    case 3:
        $query1 = "select T1.dist_dis_id dis_id, T1.dist_name, ifnull(T2.pl_weight, 0) sum_weight from ( select dist_dis_id, dist_name from district_trans where dist_lang_id = 1 order by dist_name) T1 left join (select pl_dis_id, sum(pl_weight) pl_weight from `plan` where pl_year = ".date("Y")." group by pl_dis_id)T2 on T1.dist_dis_id = T2.pl_dis_id";
        $query2 = "select T0.sect_name, T0.sect_sec_id, ifnull(T1.pl_weight,0) sum_weight from
          (SELECT sect_name, sect_sec_id FROM `section_trans` WHERE sect_lang_id = 1)T0
          left join
          (SELECT pl_sec_id, sum(pl_weight) pl_weight FROM `plan` WHERE pl_year =".date("Y")." group by pl_sec_id)T1
          on
          T0.sect_sec_id = T1.pl_sec_id";
        break;
}
view holati:
switch ($_GET['pro_id']) {
  case 2: $text = "Экилган";break;
  case 3: $text = "Кутилаётган";break;
  default: $text = "Сақланаётган";break;
}
izoh qoldirdi 18 sentabr, 17 Farhodjon (1,018 bal)
Yii2 da get bunaqa olinmaydiyu. Yii::$app->request->get('pro_id'). Shunaqa olinadi manimcha
izoh qoldirdi 18 sentabr, 17 alfraganus (515 bal)
Farhodjon aka, shu kod onlineda ishlayapdi, men 1 proyektni onlinedan kochirib olib kodidan foydalanayotgandim, localhostda ishlamayapdi
izoh qoldirdi 05 oktabr, 17 Muxiddin (180 bal)
Sayt print_r($_GET) qilib koringchi shunaqa paramter kelib turibdimi ? buni isset($_GET['pro_id']) qilib tekshiriladi.

1 ta javob

0 ovoz
javob berdi 18 sentabr, 17 Muxiddin (180 bal)

php.ini da shuni yoqib qo'yganmisiz, shuni enable qilib tekshirib koringchi.

short_open_tag=On
izoh qoldirdi 18 sentabr, 17 alfraganus (515 bal)
yoqdim aka, lekin yordam bermadi(

Assalomu alaykum, yordam.uz saytimizga xush kelibsiz.

Bu saytda o`zingizni qiziqtirgan savollarga javob olishingiz va o`z sohangiz bo`yicha savollarga javob berishingiz mumkin.

Bizning Oilamizga a'zo bo`lganingiz uchun chuqur Minnatdorchilik bildiramiz !!!

Telegram kanal YordamUzRss

...