【发布时间】:2009-12-07 10:27:15
【问题描述】:
有没有办法读取顶部的变量,该变量在底部的某个位置定义。 下面是这种情况的一个例子:
<!--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;
}
我尝试使用该函数返回值,但即使这样似乎也不起作用。
有什么办法吗?
谢谢
【问题讨论】: