yiiaseView has special $params property.
For example it's used for building breadcrumbs in default generated CRUD code templates with Gii.
You can set it like this before rendering:
use Yii;
Yii::$app->view->params['customParam'] = 'customValue';
Inside a controller you can set it like this:
$this->view->params['customParam'] = 'customValue';
Then it will be available in views (including main layout):
/* @var $this yiiwebView */
echo $this->params['customParam'];
You can also find it in official guide.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…