• [织梦吧]唯一域名:www.dedecms8.com,织梦DedeCMS学习平台.

当前位置: > 编程与数据库 > php编程 >

分享几个非常有用的PHP代码片段(3)

来源: www.dedecms8.com 编辑:织梦吧 时间:2012-02-08点击:

  sapien vel feugiat vestibulum, nulla dui pretium orci,

  non ultricies elit lacus quis ante. Lorem ipsum dolor

  sit amet, consectetur adipiscing elit. Aliquam

  pretium ullamcorper urna quis iaculis. Etiam ac massa

  sed turpis tempor luctus. Curabitur sed nibh eu elit

  mollis congue. Praesent ipsum diam, consectetur vitae

  ornare a, aliquam a nunc. In id magna pellentesque

  tellus posuere adipiscing. Sed non mi metus, at lacinia

  augue. Sed magna nisi, ornare in mollis in, mollis

  sed nunc. Etiam at justo in leo congue mollis.

  Nullam in neque eget metus hendrerit scelerisque

  eu non enim. Ut malesuada lacus eu nulla bibendum

  id euismod urna sodales. ";

  $compressed = gzcompress($string);

  echo "Original size: ". strlen($string)."\n";

  /* prints

  Original size: 800

  */

  echo "Compressed size: ". strlen($compressed)."\n";

  /* prints

  Compressed size: 418

  */

  // getting it back

  $original = gzuncompress($compressed);

 

  9. 使用PHP做Whois检查

  function whois_query($domain) {

  // fix the domain name:

  $domain = strtolower(trim($domain));

  $domain = preg_replace('/^http:\/\//i', '', $domain);

  $domain = preg_replace('/^www\./i', '', $domain);

  $domain = explode('/', $domain);

  $domain = trim($domain[0]);

  // split the TLD from domain name

  $_domain = explode('.', $domain);

  $lst = count($_domain)-1;

  $ext = $_domain[$lst];

  // You find resources and lists

  // like these on wikipedia:

  //

  // http://de.wikipedia.org/wiki/Whois

  //

  $servers = array(

  "biz" => "whois.neulevel.biz",

  "com" => "whois.internic.net",

  "us" => "whois.nic.us",

  "coop" => "whois.nic.coop",

  "info" => "whois.nic.info",

  "name" => "whois.nic.name",

  "net" => "whois.internic.net",

  "gov" => "whois.nic.gov",

  "edu" => "whois.internic.net",

  "mil" => "rs.internic.net",

  "int" => "whois.iana.org",

  "ac" => "whois.nic.ac",

标签: 非常 几个 分享

About D8

  • ©2014 织梦吧(d8) DedeCMS学习交流平台
  • 唯一网址 www.DedeCMS8.com 网站地图
  • 联系我们 1170734538@qq.com ,  QQ