php输出数据对象,php – 从变量中的字符串中获取对象数据

当对象名称(类别)直接放置时,它返回正确的值,如:

$primary = $this->dbmapper->category['primary'] ; // ( Correct Output )

但是,当将对象名称放在名为$dataname的变量中时,它返回空白,如:

$dataname = 'category';

$primary = $this->dbmapper->$dataname['primary'] ; ( Blank Output )

我的构造函数变量是

$this->dbmapper = $this->mapper();

我的功能是:

function mapper($module='')

{

$mapper = array();

$mapper['category']['table'] = 'allcategory';

$mapper['category']['primary'] = 'categoryID';

$mapper['page']['table'] = 'allpages';

$mapper['page']['primary'] = 'pageID';

return (object) $mapper;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值