为了账号安全,请及时绑定邮箱和手机立即绑定

return多个值的引用方法

return多个值的引用方法

呼唤远方 2019-04-19 16:30:07
输出指定的值,除了索引方式还有其它方式吗?publicfunctionindex(){$new=$this->index_com();//输出指定的值echo$new[2];}publicfunctionindex_com(){$list='a';$category='b';$totalCount='c';$current='d';returnarray($list,$category,$totalCount,$current);}
查看完整描述

2 回答

?
智慧大石

TA贡献1946条经验 获得超3个赞

还可以是字典,
publicfunctionindex(){
$new=$this->index_com();
//输出指定的值
echo$new[list];
}
publicfunctionindex_com(){
$list='a';
$category='b';
$totalCount='c';
$current='d';
returnarray('list'=>$list,'category'=>$category);
}
                            
查看完整回答
反对 回复 2019-04-19
?
慕田峪9158850

TA贡献1794条经验 获得超8个赞

publicfunctionindex(){
$new=$this->index_com($k);
//输出指定的值
echo$new;
}
publicfunctionindex_com($k){
$arr=['list'=>a,'category'=>'c'];
return$arr[$k];
                            
查看完整回答
反对 回复 2019-04-19
  • 2 回答
  • 0 关注
  • 701 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号