我有一個如下的函數,但是我得到了一個關於$tab
變量的警告,說明它沒有被定義。我如何定義它並不再收到此警告?在函數中定義一個變量php
<?php
/*** suggested articles as random ***/
function doArticle_suggested_small_horizontall($articleid,$title,$photo,$parentid,$catid,$altdescription) {
$tab .= "<table width=150 cellspacing=5 style=border: 1px solid #0066ff align=right>\n";
$tab .= "<tr>\n";
$tab .= "<td align=center bgcolor=#ffffff><a href='../artandculture/adetails.php?articleid=$articleid&parentid=$parentid&catid=$catid'>
<img src='../images/simage/$photo' border='0' alt='$altdescription'></a></td>\n";
$tab .= "</tr>\n";
$tab .= "<tr align=right width=150 height=80 border=0 style=border: 1px solid #ffffff>\n";
$tab .= "<td width=110 align=right dir='rtl' border=0 style=border: 1px solid #ffffff ><p class=articletitlenounderline><a href='../artandculture/adetails.php?articleid=$articleid&parentid=$parentid&catid=$catid'><strong>$title </strong></p></a></td>\n";
$tab .= "</tr>\n";
$tab .= "</table> <p> <hr class='hr99' ></hr></p>";
return $tab;
}
$tab = "";
?>
如何定義它? – Kaveh
它在第一行中定義。 (你需要刪除'.'來進行concatonation) – dstudeba
非常感謝你的幫助。 – Kaveh