0
即時通訊目前有一些麻煩提取從cookie我只想關鍵字的關鍵字提取的關鍵字就是所有繼承人我的代碼:問題從GA餅乾
function parse_ga_cookie($cookie)
{
$values = sscanf($cookie, '%d.%d.%d.%d.utmcsr=%[^|]|utmccn=%[^|]|utmcmd=%[^|]|utmctr=%[^|]');
if (count($values) !== 8) {
// return false; trigger_error(...); ... or whatever you like
throw new InvalidArgumentException("Cookie value '$cookie' does not conform to the __utmz pattern");
}
$keys = array('domain', 'timestamp', 'visits', 'sources', 'campaign', 'source', 'medium', 'keyword');
return array_combine($keys, $values);
}
print_r(parse_ga_cookie($_COOKIE['__utmz']));
這會給所有的按鍵,但如果我只打印關鍵字它只會給我陣列():/
tnx很多我在想,但我沒有把握! :) – Buff 2012-02-13 22:22:08