Skip to content

Instantly share code, notes, and snippets.

@jjsty1e
Last active June 14, 2017 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjsty1e/518c149bb75c3f47eeac89852444726b to your computer and use it in GitHub Desktop.
Save jjsty1e/518c149bb75c3f47eeac89852444726b to your computer and use it in GitHub Desktop.
php大坑
<?php
function getReferer($link)
{
$refMap = [
'baidu' => '百度',
'sougou' => '搜狗',
'360' => '360',
'google' => '谷歌'
];
foreach ($refMap as $key => $value) {
if (strpos($link, $key) !== false) {
return $value;
}
}
return '其他';
}
echo getReferer('https://www.google.com/search?workd=%FD%##%#%E%D%D%D%D%D%D%');
// so what will this output?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment