有沒有一種方法可以讀取頂部的變量,它定義了底部的哪個位置。 下面是這種情況的例子:PHP:讀取底部頂部的變量
<!--this image is somewhere on top of the page-->
<img src="/<?php print logoPath(); ?>" border="0" />
// this code is somewhere on bottom of the page
$logo_query = "select logo_path from table where id = $row->user_id";
$res_logo = mysql_query($logo_query) or die(mysql_error());
$row_logo = mysql_fetch_object($res_logo);
$logo_path = $row_logo->logo_path;
function logoPath()
{
global $logo_path;
return $logo_path;
}
我試圖用這個函數的返回值,但即使這樣似乎並沒有工作。
任何解決方案?
感謝
是的,我已經這樣做使用js。謝謝大家 – Sarfraz 2009-12-07 10:47:58