Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/275.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在PHP中回显参数_Php_Image_Variables_Echo - Fatal编程技术网

如何在PHP中回显参数

如何在PHP中回显参数,php,image,variables,echo,Php,Image,Variables,Echo,所以我有一个包含所有setparam的类 $this->setParams('matchwins', $users->getInfo($_SESSION['user']['id'], 'matchwins')); 所以我可以在我的网站上使用{matchwins}) 我试图在我的用户主页上做以下陈述 <?php $clan = $_GET["clan"]; $file = 'http://localhost/app/tpl/skins/warfare/image

所以我有一个包含所有setparam的类

$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新手,有人知道怎么回事吗?

您应该使用双引号来包含变量,单引号用于保存您尝试回显的
img
标记的
src
属性

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

我试过了,
code
code
没有work@user3818791如果这个答案不能解决您的问题,您需要更具体地说明问题所在-这个答案足以修复您的语法错误。这是不正确的。。。使用额外的分号会出现基本语法错误。答案中正确显示了代码的唯一错误。@user3818791您还应该使用
$file
变量。你已经检查过文件存在了,很好。使用它,而不是重新写入路径<代码>如果(文件_存在($file))回显“”***``**运气不好。您是否尝试过此