简体   繁体   中英

How to echo a param out in PHP

So I have a class with all setParams

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

So I could just use {matchwins} around my website)

I tried to do the following statement on my user homepage.

<?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'/>";}
?>

I'm new to PHP, does anyone know what is wrong?

您应该使用双引号将变量包括在内,单引号用于保存您要回显的img标签的src属性。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM