0

This is my yii2 url

/stock-count/area-chart/stock-area-chart?AreaChart%5Bcompany_code%5D=001&AreaChart%5Bdivision_code%5D=03&AreaChart%5Blocation%5D=0201

I want to access 'company_code' from url in view page

ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
Developer
  • 29
  • 5

2 Answers2

0

You are looking for parsing and getting data from URL Query string. Refer this Stackoverflow answer

Prabath Perera
  • 240
  • 2
  • 9
0

AreaChartController.php

$company_code = Yii::$app->request->get('AreaChart[company_code]', 'DEFAULT_VALUE');
return $this->render('view_file', ['company_code' => $company_code]);

view_file.php

<div class="company-code"><?= $company_code ?></div>
Văn Quyết
  • 2,384
  • 14
  • 29