Javascript或PHP或Zend Framework - 如何检查以前的URL?

时间:2010-10-09 21:27:16

标签: php javascript jquery zend-framework

注意:对于营销分析,此网址位于许多其他网站中(例如:http://mysite.com/marketting)。因此,用户点击它并进入我的网站。

问题: 但我如何检查他来自哪里?他来自facebook /或google.com/ stackoverflow.com或wordpress.com或etc.com

你怎么能找到他点击并到达我网站的链接???

Tried:
i tried javascript: 
/* Doesnt provide previous url, if i am not in my localhost */
/* so, doesnt work */
var referer = document.referer;

/* PHP/ZF - doesnt work, cant get from where it came */
Zend_Debug::dump($_SERVER['REQUEST_URI'] . $_SERVER['HTTP_REFERER']);


$locale = new Zend_Locale();
// Return all default locales
$found = $locale->getDefault();
print_r($found);

// Return only browser locales
$found2 = $locale->getDefault(Zend_Locale::BROWSER,TRUE);
print_r($found2);

$found3 = $locale->getEnvironment(); // getBrowser()
print_r($found3);

1 个答案:

答案 0 :(得分:2)

使用PHP轻松完成:

$_SERVER['HTTP_REFERER']