0
我有下面的代碼:WordPress的返回原來的引薦
add_filter('frm_get_default_value', 'my_custom_default_value_nrt', 10, 2);
function my_custom_default_value_nrt($new_value, $field){
if(empty($new_value))
if($field->id == 5859){ //change 5859 to the ID of the field
$get_url = $_SERVER['HTTP_REFERER']; //stores the value of the referring URL
$parse = parse_url($get_url); //parses the referring URL
$new_value = $parse['host']; //stores the domain value of the referring URL
}
return $new_value;
}
上面的代碼只返回前一頁的參照網址的域名。我希望能夠返回原來的引薦域。
我發現下面的例子可能做我想做的事情,但作爲一個PHP新手,我有點迷失在如何實現它到我有。
Get original URL referer with PHP?
什麼是去了解它的最好方法?
它來自您自己的服務器或其他服務器? – h2ooooooo
另一個。我們有一個表單來抓取引用的服務器域url。 – dgodfather
然後你不能得到原始的引用者,如果可以的話,這是因爲其他服務器已經決定把你傳遞給那裏。谷歌和其他搜索引擎使用特殊的引用刪除代碼,所以你不能看到什麼人搜索等。 – h2ooooooo