从网站上获取Favicon
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从网站上获取Favicon相关的知识,希望对你有一定的参考价值。
**Example of use:**<a href="http://www.php.net/manual/en/index.php"><img src="<?php echo get_favicon('http://www.php.net/manual/en/index.php') ?>" alt="Favicon" title="See PHP documentation" width="16" height="16" /></a>
/** * Get favicon from a URL. * * @author Pierre-Henry Soria <[email protected]> * @copyright (c) 2013, Pierre-Henry Soria. All Rights Reserved. * @param string $sUrl * @return string The favicon image. */ function get_favicon($sUrl) { $sApiUrl = 'http://www.google.com/s2/favicons?domain='; $sDomainName = get_domain($sUrl); return $sApiUrl . $sDomainName; } /** * Get domain name from a URL (helper function). * * @author Pierre-Henry Soria <[email protected]> * @copyright (c) 2013, Pierre-Henry Soria. All Rights Reserved. * @param string $sUrl * @return string $sUrl Returns the URL to lower case and without the www. if present in the URL. */ function get_domain($sUrl) { return $sHost; }
以上是关于从网站上获取Favicon的主要内容,如果未能解决你的问题,请参考以下文章