如何在HTML中使用PHP变量? [英] how do use php variable in html?

查看:671
本文介绍了如何在HTML中使用PHP变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我想用于HTML代码的PHP变量:
$ pathimage1 =mydir / images / large /;

$ pathimage2 =mydir / images / thumb /;

$ imagename =landscape.jpg;

$ K =item1;

$ row = 180;

$ colon = 200;

如何在html代码中使用这些php变量?

 < td width = $ row height = $ colon> 
< div class =classname>
< a href = $ pathimage + $ imagename
class =slide
title =
onclick =return hs.expand(this,$ K)> ;
< img src = $ pathimage2 + $ imagename
alt =/>
< / a>
< / div>
< / td>


解决方案

试试这个

 < a href =<?php echo $ pathimage。$ imagename;?> 
class =slide
title =
onclick =return hs.expand(this,$ K)>
< img src =<?php echo $ pathimage2。$ imagename;?>
alt =/>
< / a>


Below are the PHP variables I'd like to use in my HTML code:

var

$pathimage1="mydir/images/large/";

$pathimage2="mydir/images/thumb/";

$imagename="landscape.jpg";

$K="item1";

$row=180;

$colon=200;

how does one use these php variables in html code?

<td width=$row height= $colon >
<div class="classname">
<a href=$pathimage + $imagename 
 class="slide" 
 title="" 
 onclick="return hs.expand(this, $K)">
 <img src=$pathimage2 + $imagename  
 alt=""/>
     </a>
 </div>
 </td>

解决方案

Try like this

<a href="<?php echo $pathimage.$imagename;?>" 
 class="slide" 
 title="" 
 onclick="return hs.expand(this, $K)">
 <img src="<?php echo $pathimage2.$imagename;?>"
     alt=""/>
</a>

这篇关于如何在HTML中使用PHP变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆