【发布时间】:2014-02-14 21:23:38
【问题描述】:
对不起,菜鸟问题,但是,我如何从数组中打印 cid1 和 cid2 的值?
这里有简单的代码:
// Handle the parsing of the _ga cookie or setting it to a unique identifier
function gaParseCookie() {
if (isset($_COOKIE['_ga'])) {
list($version,$domainDepth, $cid1, $cid2) = split('[\.]', $_COOKIE["_ga"],4);
$contents = array('version' => $version, 'domainDepth' => $domainDepth, 'cid' => $cid1.'.'.$cid2);
$cid = $contents['cid'];
}
else $cid = gaGenUUID();
return $cid;
}
echo "Welcome " . $contents['cid1'] . "!<br>";
【问题讨论】:
-
你试过
print_r功能吗? us1.php.net/print_r -
^ 或 foreach 循环也可以。
-
我不明白我必须在 print_r 中插入哪些参数。你能写出来,它应该是什么样子的吗?
-
@КонстантинРусанов:首先阅读 txtechhelp 给你的链接。
-
只是我还是 $content 没有索引 cid1?我只看到它有一个 cid 索引 - 它将 cid1 与 cid2 连接起来