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
  • 129,293
  • 10
  • 87
  • 97
Developer
  • 19
  • 4

2 Answers2

0

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

dryize
  • 240
  • 2
  • 8
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,028
  • 12
  • 28