| 
 
| 
×
马上注册,免费下载更多dz插件网资源。您需要 登录 才可以下载或查看,没有账号?立即注册 
  为什么 网站标题 一直没有获取到。。。这样的问题,研究了很久没有搞好。有没有大神帮忙改一改。复制代码<?php/** 获取META信息 */function get_sitemeta($url) {         $data = file_get_contents($url);              $meta = array();     if (!empty($data)) {          #Title          preg_match('/<TITLE>([\w\W]*?)<\/TITLE>/si', $data, $matches);          if (!empty($matches[1])) {               $meta['title'] = $matches[1];          }                   #Keywords          preg_match('/<META\s+name="keywords"\s+content="([\w\W]*?)"/si', $data, $matches);                   if (empty($matches[1])) {               preg_match("/<META\s+name='keywords'\s+content='([\w\W]*?)'/si", $data, $matches);                        }          if (empty($matches[1])) {               preg_match('/<META\s+content="([\w\W]*?)"\s+name="keywords"/si', $data, $matches);                        }          if (empty($matches[1])) {               preg_match('/<META\s+http-equiv="keywords"\s+content="([\w\W]*?)"/si', $data, $matches);                        }          if (!empty($matches[1])) {               $meta['keywords'] = $matches[1];          }                   #Description          preg_match('/<META\s+name="description"\s+content="([\w\W]*?)"/si', $data, $matches);                   if (empty($matches[1])) {               preg_match("/<META\s+name='description'\s+content='([\w\W]*?)'/si", $data, $matches);                        }          if (empty($matches[1])) {               preg_match('/<META\s+content="([\w\W]*?)"\s+name="description"/si', $data, $matches);                                  }          if (empty($matches[1])) {               preg_match('/<META\s+http-equiv="description"\s+content="([\w\W]*?)"/si', $data, $matches);                        }          if (!empty($matches[1])) {               $meta['description'] = $matches[1];          }     }      return $meta;}?>                        <?php$stie =get_meta_tags('http://www.'.$_GET['url']);$title = $stie['title'];$keywords = $stie['keywords'];$description = $stie['description'];echo "<b>网站标题:</b> $title<br>";echo "<b>网站关键字:</b> $keywords<br>";echo "<b>网站描述:</b> $description<br>";?>        
    
    
        ©DZ插件网所发布的一切资源仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站内容为站长个人技术研究记录或网络,不提供用户交互功能,所有内容版权归原作者所有。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,得到更好的正版服务。
 您在本站任何的赞助购买、下载、查阅、回复等行为等均表示接受并同意签订《DZ插件网免责声明协议》。
 如有侵权请邮件与我们联系处理: discuzaddons@vip.qq.com 并出示相关证明以便删除。敬请谅解!
 | 
 |