title: Getting base URL in Yii 2
body: <p>I am trying to get the base URL for the project in Yii 2 but it doesn't seem to work. According to <a href="http://www.yiiframework.com/forum/index.php/topic/22159-getbaseurl-returns-empty/page__view__findpost__p__109510" rel="noreferrer">this page</a> you used to be able to do:</p>
  
  <pre><code>Yii::app()-&gt;getBaseUrl(true);
  </code></pre>
  
  <p>In Yii 1, but it seems that <a href="http://www.yiiframework.com/doc-2.0/yii-web-request.html#getBaseUrl()-detail" rel="noreferrer">that method</a> in Yii 2 no longer accepts a parameter?</p>
  
  <p>I've tried doing it without true, such as:</p>
  
  <pre><code>Yii::$app-&gt;getBaseUrl();
  </code></pre>
  
  <p>But it just returns empty.</p>
  
  <p>How can you do this in Yii 2?</p>