【发布时间】:2016-09-17 20:50:03
【问题描述】:
class database {
public function dataarray() {
$array = array('John', 'Alex', 'Smith','Doe','Mane','Rio');
}
}
$export = new database();
echo $export->dataarray(); // ??? what echo code/ other style code, to show only name 'John' value.
我只想回显上面 $array 的“值”(John)。如果未指定密钥,我该如何实现?有可能吗?
【问题讨论】:
-
你需要从方法中返回你的数据。然后你就可以访问你想要的索引了。
-
为什么这个问题两次被否决?