//注册函数
$smarty->register_function('getphotopath', 'smarty_photo_path');//函数
function smarty_photo_path($params)
{
    extract($params);
    $id = str_pad($id, 9, "0", STR_PAD_LEFT);
    if(strpos($url, "/") === false)
        $url .= "/";
    return $url.$id;
}//在模板中调用函数
{foreach item=article from=$articles}
    文章编号:{$article.id}
    <img src="{getphotopath id=$article.id, url=$sitephoto}" width="150" height="160" border="0" />
{/foreach}直接调用 {$article.id} 是正确的,在自定义函数里调用 $article.id 居然是 array.id 
该如何调用才对?