开发者

echo php function in HTML, will it work?

I have a drop shadow function in PHP.

In my php page, I have HTML set up like this:

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

The php function is like this:

     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'开发者_如何学JAVA>";
    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;
}

This function doesn't get called because the echo "hello" doesn't show up.

How should I solve this?

Thanks


Because you are putting function output into src tag? You would have something like this:

img src="Hello table border..."

Check in page source, you should see hello there ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜