2016-09-22 61 views
-2

我在cakephp中創建登錄頁面。我沒有寫「登錄」,而是想要展示一張圖片。這是我嘗試:將圖像添加到cakephp的登錄頁面

<br> 
<div class="index large-4 medium-4 large-offset-4 medium-offset-4 columns"> 
    <div class="panel"> 
     <h2 class="text-center"><img src="img/cake.icon.png" /></h2> 
     <?= $this->Form->create(); ?> 
      <?= $this->Form->input('email'); ?> 
      <?= $this->Form->input('password', array('type' => 'password')); ?> 
      <?= $this->Form->submit('Login', array('class' => 'button')); ?> 
     <?= $this->Form->end(); ?> 
    </div> 
</div> 

在上面的佈局,我嘗試添加圖像logo.png,而不是顯示「登錄」。但是,圖像沒有加載。我已將圖像放入webroot/img/logo.png中。但是,圖像未加載。這有什麼問題?我應該更改或添加什麼?

回答

1

您應該參考文獻:HtmlHelper::image

試試這個:

<h2 class="text-center"> 
    <?php echo $this->Html->image('logo.png'); ?> 
</h2> 
0

的改變src使用logo.png代替cake.icon.png

<img src="img/logo.png" /> 
+0

我試了一下,它不工作! – SSS

+0

爲了解決這個問題,你需要確定爲什麼圖像沒有被頁面加載。請確保您可以通過http:// yourUrl /img/logo.png訪問該映像 - 如果可以在瀏覽器中加載它,請在加載頁面時按f12鍵,並在頁面嘗試加載時查看返回的狀態代碼圖片 – hairmot