2016-12-31 12 views
0

のHTML画像要素の生成は「localhost /プロジェクト名/ユーザー/追加」その後、私は私はその後、私は</p> <p><a href="https://i.stack.imgur.com/FYJhl.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FYJhl.jpg" alt="enter image description here"></a></p> <p>のようなユーザーアカウントの画像を取得するしかし、私は閲覧するときは「localhost /プロジェクト名/ユーザー」を参照するとcakephpの

enter image description here

のようなユーザーアカウントの画像を取得するしかし、私は、正しい画像すべてのアクションを見たいです。

私のコードは以下の通りです。

<a href="#" class="dropdown-toggle" data-toggle="dropdown"> 
    <img src="img/penguen.jpg" class="user-image"> 
    <?php $this->User = ClassRegistry::init('User');?> 
    <span class="hidden-xs"> 
     <?php if (AuthComponent::user('id')): ?> 
     <?= AuthComponent::user('username') ?> 
     <?php endif; ?> 
    </span> 
</a> 
+0

は 'localhost/ProjectName/users/img /'のように 'users'フォルダの' img'フォルダですか? – EhsanT

+0

app/webroot/img/imagenameこれは私の画像リンクです –

+0

あなたのコメントにあなたが提供したパスはあなたの質問にあるパスと共通していません! – EhsanT

答えて

2
<img src="img/penguen.jpg" class="user-image"> 

あなたの間違いでした。

あなたのために「有効」リンクを生成するためのヘルパー、問題解決の活用:

$this->Html->image('penguen.jpg', ['class' => 'user-image']); 

だけ間違って行くことができ、手動で構築されたURLを、とマニュアルAまたはIMGタグを使用しないでください。

関連する問題

 関連する問題