Yii2: how to change/add response headers?
<p>I have some truble with Yii2. I try to add/set response headers in my controller's action. Below is code:</p>

<pre><code>   Yii::$app-&gt;response-&gt;headers-&gt;set('Content-type', ['application/pdf']);
   Yii::$app-&gt;response-&gt;headers-&gt;set('Content-Disposition', ['inline', 'filename=' . $fileName]);
   Yii::$app-&gt;response-&gt;headers-&gt;set('Content-Transfer-Encoding', ['binary']);
   Yii::$app-&gt;response-&gt;headers-&gt;set('Content-Length', [$fileSize]);
   Yii::$app-&gt;response-&gt;headers-&gt;set('Accept-Ranges', ['bytes']);

   return readfile($filePath);
</code></pre>

<p>If I change set() to add(), or second argument from array to string so get no reaction. Pdf file is not opened. But if I use native PHP header() method - all works correct. </p>