在HTML中回显php函数,它会起作用吗?

时间:2009-11-27 22:19:35

标签: php html

我在PHP中有一个投影功能。

在我的php页面中,我设置了这样的HTML:

 <img src="<?php echo drpShadow($img_path[$i]);?>" />

php函数是这样的:

     function drpShadow($pic_url){ echo "Hello";
    list($width, $height)=getimagesize($pic_url);
    $pic_display="<table border='0' style='display:inline;' cellspacing='0' cellpadding='0'><tr><td width='4px' height='$height'><img src='/SV/Graphics/drop_shadow_top_left_corner_4x4.jpg'><br>";
    for ($i=0; $i<($height-4); $i++){
        $pic_display.="<img src='/SV/Graphics/drop_shadow_left_4x1.jpg'><br>";
    }
    $pic_display.="</td><td width='$width' height='$height'><img src='$pic_url'></td></tr><tr><td colspan='2' height='4px' width='($width+4)'><img src='/SV/Graphics/drop_shadow_left_bottom_corner_4x4.jpg'>";
    for ($i=0; $i<=($width-6); $i++){
        $pic_display.="<img src='/SV/Graphics/drop_shadow_bottom_1x4.jpg'>";
    }
    $pic_display.="<img src='/SV/Graphics/drop_shadow_right_bottom_corner_4x4.jpg'></td></tr></table>";
    return $pic_display;
}

此函数未被调用,因为回显“hello”未显示。

我该如何解决这个问题?

由于

1 个答案:

答案 0 :(得分:3)

因为您将函数输出放入src标记中? 你会有这样的事情:

img src =“Hello table border ...”

签入页面源,你应该看到你好;)