php传递变量名 直接那样调用可以实现的,楼主把问题说清楚点.根据传进的$ID,那就判断下$ID. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 class Mgr { require_once("../config/config.php"); //get div static function getDiv($ID) { return portalConfig::$$ID;//根据传进的$ID,调用制定的层的参数,例如$top; } } 比如要调用 $top使用方法就是:$array = Mgr::getDiv('top');这样就可以了 测试过的。可以的 要调用配置中的 $bottom 就是$array = Mgr::getDiv('bottom '); <?phpfunction portalConfig($ID) { $top = array( "height" => "100px", "width" => "980px", "margin" => "0", "background" => "transparent url(images/top.jpg)" ); $bottom = array( "height" => "100px" ); if ($ID==1) { return $top; }elseif ($ID==2){ return $bottom; }} class Mgr { //get div static function getDiv($ID) { return portalConfig($ID);//根据传进的$ID,调用制定的层的参数,例如$top; } } ?> 已经调试好了,将portalConfig::$ID改成portalConfig::$$ID即可以了~~~~~~ mysql 添加数据后在数据库里的排序 PHP soap通信时http请求默认Content-Type=soap+xml,怎么修改成text/xml 遇到一个奇怪的问题? 如何查找指定键的路径 推荐学习PHP的好书或电子文档 急!!100分求网站推广软件和注册码!在线等 把程序从WIN2K上传到LINUX上所产生了问题急求! 问大家一个问题:用php如何连接一个远程数据库,比如说:我在租用的空间里,如何连接并访问公司数据库服务器上的数据.另一个问题:公司数据库 有几个问题? PHP与SQL Server的问题 sql优化,程序优化 关于PHP和FLASH交互的问题~求达人~
{
require_once("../config/config.php");
//get div
static function getDiv($ID)
{
return portalConfig::$$ID;//根据传进的$ID,调用制定的层的参数,例如$top;
}
}
比如要调用 $top
使用方法就是:
$array = Mgr::getDiv('top');
这样就可以了
可以的
要调用配置中的 $bottom
就是$array = Mgr::getDiv('bottom ');
<?phpfunction portalConfig($ID)
{
$top = array(
"height" => "100px",
"width" => "980px",
"margin" => "0",
"background" => "transparent url(images/top.jpg)"
);
$bottom = array(
"height" => "100px"
);
if ($ID==1) {
return $top;
}elseif ($ID==2){
return $bottom;
}
} class Mgr
{
//get div
static function getDiv($ID)
{
return portalConfig($ID);//根据传进的$ID,调用制定的层的参数,例如$top;
}
} ?>