阵列中的数据使用 [英] Using data in an array

查看:90
本文介绍了阵列中的数据使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的PHP页面,我得到后续的输出:

On my php page, I am getting the follow output:

Array ( [contact/email] => users_name@email_address.com )

这是通过在php code以下行产生的:

This is produced via the following line in the php code:

print_r($openid->getAttributes());

我如何提取文本 users_name@email_address.com 从数组并且将其放入一个变量 $ strEmail;

How do I extract the text users_name@email_address.com from that array and stick it into a variable $strEmail;?

所以,当我附和变量:

回声$ strEmail;

这应该输出以下屏幕:

users_name@email_address.com

推荐答案

数组分配给一个变​​量,然后你可以轻松地访问它:

Assign the array to a variable and then you can easily access it:

$attributes = $openid->getAttributes();
$strEmail = $attributes['contact/email'];
echo $strEmail; // => users_name@email_address.com

这篇关于阵列中的数据使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆