php
  • image
  • variables
  • echo
  • 2014-07-09 34 views 0 likes 
    0

    所以我必須與所有setParams類如何呼應設置了一個param出PHP

    $this->setParams('matchwins', $users->getInfo($_SESSION['user']['id'], 'matchwins')); 
    

    所以我可以只使用{matchwins}在我的網站)

    我試圖做我的用戶下面的語句主頁。

    <?php 
        $clan = $_GET["clan"]; 
        $file = 'http://localhost/app/tpl/skins/warfare/images/clans/'. $clan .'/avatar.png'; 
        if (file_exists($file)) {echo "<img src='http://localhost/app/tpl/skins/warfare/images/clans/'. $clan .'/avatar.png'/>";} 
    ?> 
    

    我是PHP新手,有誰知道什麼是錯的?

    +1

    做你試過這種' 「」;' –

    回答

    2

    您應該使用雙引號以包含變量,單引號用於保存您試圖回顯的img標記的src屬性。

    echo "<img src='http://localhost/app/tpl/skins/warfare/images/clans/" . $clan . "/avatar.png'/>"; 
    
    +0

    我想,'code' 」;} ?>'code' does not work – user3818791

    +1

    @ user3818791如果此答案無法解決您的問題,則需要更具體地指出問題的位置是 - 這個答案足以解決你的語法錯誤。 –

    +0

    這是不正確的......你有額外的分號基本的語法錯誤。你的代碼唯一的錯誤是在答案中正確顯示。 – doublesharp

    相關問題