google 收录查询代码

 更新时间:2016年11月25日 16:04  点击:1281
本代码是一款站长常用工具了,用来查询google 收录代码,可以查询天

<option value="1">自定义天数</option>
      <option value="d">查询昨日收录情况</option>
      <option value="w">查询最近1星期收录情况</option>
      <option value="m">查询最近1月收录情况</option>
      <option value="m2">查询最近2月收录情况</option>
      <option value="m3">查询最近3月收录情况</option>
      <option value="m6">查询最近6月收录情况</option>
      <option value="y">查询最近1年收录情况</option>
      <option value="all">查询总的(所有日期)收录情况</option>

等信息。

function GetPage($url)
{
$buf=parse_url($url);
if($buf['scheme']=="http")//如果是URL
 {
 $host=$buf['host'];
 $page=$buf['path'];
 if(trim($buf['query'])!=="") $page.="?".trim($buf['query']);

 $myHeader="GET $url HTTP/1.1rn";
 $myHeader.="Host: $hostrn";
 $myHeader.="Connection: closern";
 $myHeader.="Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5rn";
 $myHeader.="Accept-Language: zh-cn,zh;q=0.5rn";
 $myHeader.="Accept-Charset: gb2312,utf-8;q=0.7,*;q=0.7rn";
 $myHeader.="User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.7.6) Gecko/20050226 Firefox/1.0.1 Web-Sniffer/1.0.20rn";
 $myHeader.="Referer: http://$host/rnrn";

 $server=$host;
 $port=80;

 $res="";
 if(false!==($fp = @fsockopen ($server, $port, $errno, $errstr, 30)))
  {
  @fputs ($fp, $myHeader);
  while (!@feof($fp)) $res.= @fgets ($fp, 1024);
  @fclose ($fp);
  }
 else return false;

 if(strlen($res)==0) return false;
 
 return $res;
 }
else//如果是本地文件
 {
 $fileName=$url;
 if(false!==@file_exists($fileName))
  {
  if(false!==($buf=@implode("",file($fileName)))&&@strlen($buf)>0)
   {
      
    return $buf;
   }
  else return false;
  }
 else return false;
 }
}


function  GetContent($str,$x,$y){ 
 $tem=strstr($str,$x);
 return substr($tem,0, strpos($tem,$y));
}

对取得的google信息进行分析并且在本地。

if (isset($q))
{
$TheUrl="http://www.google.cn/search?q=+site:".$q."&num=20&complete=1&hl=zh-CN&lr=&newwindow=1&as_qdr=".$t."&start=".$p."&sa=N";

 $TheThie=GetPage($TheUrl);
}
 $TheBody=GetContent($TheThie,"<div id=res class=med>","<div id=bsf style");
    $TheBody=iconv( "UTF-8", "gb2312//IGNORE" , $TheBody);
 $TheBody=str_replace("<!--z--><p><i>","<!--z--><!--<p><i>",$TheBody);
 $TheBody=str_replace('<br clear="all"/>','<br clear="all"/>',$TheBody);
    $TheBody=preg_replace('<a href="/search?num=20(.+?)amp;as_qdr=(.+?)&amp;q=site:(.+?)&amp;start=(.+?)&amp;sa=N">','a href=?q=$3&t=$2&p=$4>&nbsp;&nbsp;&nbsp;&nbsp;<!--z--',$TheBody);
 $TheBody=str_replace("该网站可能含有恶意软件,有可能会危害您的电脑。","",$TheBody);
 $TheBody=str_replace("/interstitial?url=","",$TheBody);
 $TheBody=str_replace("- <nobr>","",$TheBody);
 $TheBody=str_replace("类似网页","",$TheBody);
        $total=GetContent($TheThie,"</b></div><p>","</b> - <b>");
        $total=iconv( "UTF-8", "gb2312//IGNORE" , $total);
        $total=GetContent($total,"有 <b>","</b> 项");
 $total=str_replace("有 <b>","",$total);
 $total=str_replace(",","",$total);
        $total=intval($total);

pdo 调用mysql 存储过程

$stmt = $dbh->prepare("CALL test(:bb)");
    $aa = '';
    $stmt->bindParam(':bb', $aa, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 4000);
var_dump($stmt->execute());
var_dump($aa);
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));

$stmt = $dbh->prepare("select * from userinfo where u_id=:id");
    $aa = 1;
    $stmt->bindParam(':id', $aa, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 4000);
var_dump($stmt->execute());
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));

 

php 切取图片代码

function resizeThumbnailImage($thumb_image_name, $image, $width, $height, $start_width, $start_height, $scale){
 list($imagewidth, $imageheight, $imageType) = getimagesize($image);
 $imageType = image_type_to_mime_type($imageType);
 
 $newImageWidth = ceil($width * $scale);
 $newImageHeight = ceil($height * $scale);
 $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);
 switch($imageType) {
  case "image/gif":
   $source=imagecreatefromgif($image);
   break;
     case "image/pjpeg":
  case "image/jpeg":
  case "image/jpg":
   $source=imagecreatefromjpeg($image);
   break;
     case "image/png":
  case "image/x-png":
   $source=imagecreatefrompng($image);
   break;
   }
 imagecopyresampled($newImage,$source,0,0,$start_width,$start_height,$newImageWidth,$newImageHeight,$width,$height);
 switch($imageType) {
  case "image/gif":
     imagegif($newImage,$thumb_image_name);
   break;
       case "image/pjpeg":
  case "image/jpeg":
  case "image/jpg":
     imagejpeg($newImage,$thumb_image_name,90);
   break;
  case "image/png":
  case "image/x-png":
   imagepng($newImage,$thumb_image_name); 
   break;
    }
 chmod($thumb_image_name, 0777);
 return $thumb_image_name;
}

这是一个简单的用php 实现的模板教程物。

class  TEMPLATE
   {
                  
              
                      private  $path = "." ;          #根目录        
                             
                   private $var;
                  
                   private $tplDir = "template"; #模板存储目录
                  
                   private $tplExt = "tpl";      #模板文件的后缀名
                  
                   private $tplId = 0 ;   #模板的ID号
                  
                   private $compileDir = "template_c";  #编译后的php文件存放目录
                  
                   private $isCache=false ; #是否用缓存 (默认不启动)
                  
                   private $cacheId = 1; #缓存文件ID号
                  
                   private $cacheLeftTime=3600; #缓存有效期 (默认保存3600秒)
                  
                   private $cacheDir = "cache"; #缓存文件存储目录
                  
                   private $autoRefresh = false ; #是否自动刷新
                  
                   private $pattern = array(
                  
                                           "/({dw:)s*includes*filename=s*"(.+..+)s*"s*(/})/i",#包含文件
                                           "/({dw:)s*field.(.+)s*(/})/i",#局部变量
                                           "/({dw:)s*global.(.+)s*(/})/i",#全局变量
                                           "/({dw:)s*foreachs*(.+)s*ass*(.+)s*(/})/i",#foreach 语句
                                           "/({dw:)s*ends*foreachs*(/})/i",           #foreach 结束
                                           "/({dw:)s*ifs*((.+))(/})/i",
                                           "/({dw:)s*elseifs*((.+))(/})/i",
                                           "/({dw:)s*elses*(/})/i",
                                           "/({dw:)s*ends*ifs*(/})/i",
                                                                
                                );
                  
                   private $replacement = array(
                  
                                           '<?php echo $this->inc_file("\2"); ?>',
                                           "<?php echo $\2;?>",
                                           "<?php global $\2;n echo $\2; ?>",
                                           "<?php foreach($\2 as $\3){ ?>",
                                           "<?php } ?>",
                                           "<?php if (\2) {  ?>" ,
                                           "<?php }else if(\2){ ?>",
                                           "<?php }else{ ?>",
                                           "<?php  } ?>",
                                          
                                          
                                          
                                          
                                                                                                  
                                                                   );
                  
                  
                   #构造函数
                  
                   function __construct($path = "", $tplDir="", $compileDir="",$isCache="",$cacheLeftTime="",$cacheDir="" ,$autoRefresh="")
                   {
                           $this->path = $path ? $path : $this->path ;
                          
                           $this->tplDir = $tplDir ? $tplDir : $this->tplDir ;
                          
                           $this->compileDir = $compileDir ? $compileDir : $this->compileDir ;
                          
                           $this->isCache = is_bool($isCache) ? $isCache : $this->isCache ;
                          
                           $this->cacheLeftTime = $cacheLeftTime ? $cacheLeftTime : $this->cacheLeftTime ;
                          
                           $this->cacheDir = $cacheDir ? $cacheDir : $this->cacheDir ;
                          
                           $this->autoRefresh = is_bool($autoRefresh) ? $autoRefresh : $this->autoRefresh ;
                   }
                  
                  
                   #兼容php4
                  
                   function TEMPLATE($path = "", $tplDir="", $compileDir="",$isCache="",$cacheLeftTime="",$cacheDir="" ,$autoRefresh="")
                   {
                           $this->__construct($path = "", $tplDir="", $compileDir="",$isCache="",$cacheLeftTime="",$cacheDir="" ,$autoRefresh="");
                   }
                   function  __get($property)
                   {
                           return $this->$property ;
                   }
                  
                  
                   function __set($property,$value)
                   {
                           return $this->$property = $value ;
                   }
                  
                  
                  
        #给模板中的变量赋值
        # $tplVal 模板中的变量名                  
                  
                   function assign($tplVal ,$value="")
                   {
                           if (is_array($tplVal))
                           {
                                   foreach ($tplVal as $key => $val)
                                   {
                                           if (!empty($key))
                                          
                                           $this->var[$key] = $val ;
                                   }
                           }
                           else {
                                   if (!empty($tplVal))
                                  
                                   $this->var[$tplVal] = $value ;
                           }
                   }
                  
                   #输出文件内容函数
                  
                   function display($tplFile,$tplId=0,$cacheId = 1,$cacheLeftTime="")
                   {
                           if (empty($tplFile)) die("Template "{$tplFile}" not exist !");
                          
                           $this->cacheId = $cacheId ?  md5($cacheId) : md5($this->cacheId);
                          
                           $cacheFile = $this->path. "/".$this->cacheDir."/".$tplFile.$this->cacheId ;
                          
                           if ($this->check_cache($cacheFile,$cacheLeftTime))  #当缓存文件存在且不过期时直接从缓存文件读取内容
                           {
                                   echo $this->read_file($cacheFile);
                           }else {
                          
                              $tpl = $this->path."/".$this->tplDir."/".$tplFile.".".$this->tplExt;
          
                              $tplContent = $this->read_file($tpl);   #读取模板文件的内容
          
                             $compileContent= $this->compile_file($tplContent); #对读取出来的文件进行编译
           
                             $this->tplId = $tplId ? $tplId : $this->tplId ;
           
                             $compileFile = $this->path."/".$this->compileDir."/".md5($this->tplId)."".$tplFile.".php";
           
                             $this->write_file($compileFile,$compileContent);#将编译后的内容写入相应的文件中;
                          
                           @extract($this->var);
                          
                        ob_start();
                          
                           include_once($compileFile);
                          
                           $content = ob_get_contents() ;
                          
                           ob_end_clean() ;
                          
                           if ($this->isCache){
                                                     
                            $this->write_file($cacheFile,$content) ;# 帮编译好的内容写入缓存文件
                           }
                          
                           echo $content ;
                          
                           }
                   }
                  
                  
/*                   function  trim_tag($content)
                   {
                           $content = str_replace($this->startTag,"",$content);
                          
                           $content = str_replace($this->endTag,"",$content);
                                  
                           //$content = trim($content);
                          
                           return $content ;
                   }*/
                  
                   # 编译文件函数
                  
                   function compile_file($content=null)
                   {
                          
                           $content = $content ? $content :die("Compile fail!") ;
                          
                           //$content = $this->trim_tag($content);
                          
                           $content = preg_replace($this->pattern,$this->replacement,$content);
                          
                           return $content;
                          
                   }
                  
                   #解析包含文件
                  
                   function inc_file($filename,$tplId="",$cacheId="",$cacheLeftTime="")
                   { 
                           $file = $this->path."/".$this->tplDir."/".$filename ;
                          
                           if (file_exists($file))
                           {
                                   $filename = str_replace(".".$this->tplExt,"",$filename);
                                  
                           return         $this->display($filename,$tplId,$cacheId,$cacheLeftTime);
                           }
                           else die("Template "{$filename}" not exist");
                   }
                          
                   #读取文件内容函数
                  
                   function  read_file($filename)
                   {
                           if (!file_exists($filename)) die("Read file fail") ;
                          
                           return file_get_contents($filename);
                   }
                  
                   #内容写入函数
                  
                   function write_file($filename,$content,$mode="wb")
                   {
                          
                           $filename = trim($filename);
                          
                           $content = $content ? stripslashes(trim($content)) : exit();
                          
                           if (!file_exists($filename))
                           {
                                   $array = explode("/",$filename);
                                  
                                   $count = count($array);
                                  
                                   $path = "";
                                  
                                   for ($i = 0 ; $i <$count-1 ; ++$i )
                                   {
                                           if(!file_exists($path .= $array[$i]."/"))
                                           {
                                                   mkdir($path,0777);
                                           }
                                   }
                           }
                           $handle = fopen($filename,$mode) ;
                          
                           fwrite($handle,$content);
                          
                           fclose($handle);
                          
                           return true;       
                   }
                  
                  
                  
                   # 清除缓存
                  
                   function clear_dir($dir="")
                   {
                          
                           $dir = $this->path."/".$dir;
                          
                           $handle = opendir($dir);
                          
                           if (file_exists($dir))
                           {
                                   while ($file = readdir($handle))
                                   {
                                           if ($file !="." && $file != "..")
                                  
                                           unlink($dir."/".$file);
                                   }
                          
                             closedir($handle);
                            
                             return true;
                           }
                          
                           else {
                                   return false;
                           }
                          
                          
                   }
                  
                   #清除所有缓存
                  
                   function clear_all_cache()
                   {
                           if ($this->clear_dir($this->cacheDir) && $this->clear_dir($this->compileDir))
                                  
          
                           return true;
                   }
                  
                  
                  
                   #检查缓存是否过期
                  
                   function check_cache($cacheFile,$cacheLeftTime="")
                   {
                          
                           $cacheLeftTime = $cacheLeftTime ? $cacheLeftTime : $this->cacheLeftTime;
                          
                           if (!file_exists($cacheFile)) return false ;
                          
                          $time = $this->get_time($cacheFile) + $cacheLeftTime ;
                          
                           if ($time <time())
                           {
                                   unlink($cacheFile);
                                  
                                  
                                  
                                   return false;
                           }
                          
                           return true;
                          
                   }
                  
                  
                  
                   # 获取文件最后编辑时间
                  
                   function get_time($filename)
                   {
                           if (!file_exists($filename)) return false;
                          
                           return filemtime($filename);
                   }
                  
                  
                  
   }
                  

 

  

下面来看看在很多程序语言中会使用到的class吧,现在会举个简单的实例来实现php class,类申明,class使用方法哦。

<?php
/*
 * Explorer! 函数库
 * 编写日期:2008-06-29
 * 最后更新:2008-07-18 2:08
 *
 */
class System{//系统部分
 function usr_level($name){
  $SQL = new MySQL();
  $SQL->Query("SELECT `level` FROM `members` WHERE `username` = '$name';");
  $SQL->NextRecord();
  $TMP = $SQL->GetRecord('level');
  $SQL->Free();
  return $TMP;
 }
 function channel_level($cid){
  $SQL = new MySQL();
  $SQL->Query("SELECT `level` FROM `channels` WHERE `id` = $id;");
  $SQL->NextRecord();
  $TMP = $SQL->GetRecord('id');
  $SQL->Free();
  return $TMP;
 }
 function uid2name($uid){
  $SQL = new MySQL();
  if($SQL->Query("SELECT `username` FROM `members` WHERE `uid` = $uid;")){
   $SQL->NextRecord();
   $TMP = $SQL->GetRecord('username');
   $SQL->Free();
   return $TMP;
  }else{
   return 0;
  }
 }
 function name2uid($name){
  $SQL = new MySQL();
  if($SQL->Query("SELECT `uid` FROM `members` WHERE `username` = '$name';")){
   $SQL->NextRecord();
   $TMP = $SQL->GetRecord('uid');
   $SQL->Free();
   return $TMP;
  }else{
   return 0;
  }
 }
 function sysinfo($Name){//获取系统信息
  $SQL = new MySQL();
  $SQL->Query("SELECT * FROM `sysinfo`;");
  $SQL->NextRecord();
  $TMP = $SQL->GetRecord($Name);
  $SQL->Free();
  return $TMP;
 }
 function find_member($name){//查找该用户(注册时需要)
  $SQL = New MySQL();
  $SQL->Query("SELECT * FROM `members` WHERE `username` = '$name';");
  $RS = $SQL->RowS();
  $SQL->Free();
  if($RS)
   return 1;
  else
   return 0;
 }
 function str_safe($str){//字符串安全过滤
  $str = str_replace($str,";",";");
  $str = str_replace($str,"'","‘");
  $str = str_replace($str,"/","/");
  $str = str_replace($str,"`","`");
  $str = str_replace($str,"\","\");
  return $str;
 }
 function GetMyIP()
 {
  if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"])
   $ip = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];
  elseif ($HTTP_SERVER_VARS["HTTP_CLIENT_IP"])
   $ip = $HTTP_SERVER_VARS["HTTP_CLIENT_IP"];
  elseif ($HTTP_SERVER_VARS["REMOTE_ADDR"])
   $ip = $HTTP_SERVER_VARS["REMOTE_ADDR"];
  elseif (getenv("HTTP_X_FORWARDED_FOR"))
   $ip = getenv("HTTP_X_FORWARDED_FOR");
  elseif (getenv("HTTP_CLIENT_IP"))
   $ip = getenv("HTTP_CLIENT_IP");
  elseif (getenv("REMOTE_ADDR"))
   $ip = getenv("REMOTE_ADDR");
  else
   $ip = "127.0.0.1";
  return $ip;
 }
 function Version(){
  return "1.0.9";
 }
}
class MySQL{//数据库部分
 var $DBServer = 'localhost';//服务器
 var $DBName = '';//数据库名称
 var $DBUser = '';//数据库用户
 var $DBPass = '';//数据库密码
 var $OnErrorResume = 1;//错误提示关闭
 var $LinkID = 0;//连接句柄
 var $QueryID = 0;//查询句柄
 var $ResultS = array();//查询结果集
 var $Error = '';//错误信息
 function Connect($Srv = "",$Usr = "",$Pass = "",$DB = ""){//连接数据库
  if($Srv == "") $Srv = $this->DBServer;
  if($Usr == "") $Usr = $this->DBUser;
  if($Pass == "") $Pass = $this->DBPass;
  if($DB == "") $DB = $this->DBName;
  if($this->LinkID == 0){
   $this->LinkID = @mysql_connect($Srv,$Usr,$Pass) or die("数据库连接失败,请联系管理员修复此问题。");
  }
  @mysql_select_db($DB,$this->LinkID) or die("数据库选择失败,请联系管理员修复此问题。");
  return $this->LinkID;
 }
 function Free(){//释放查询结果
  @mysql_free_result($this->QueryID);
  $this->QueryID = 0;
 }
 function RowS(){//查询到的记录总数
  if(!$this->QueryID) return 0;
  return @mysql_num_rows($this->QueryID);
 }
 function NextRecord(){//下一条记录
  if(!$this->QueryID) return 0;
  $this->ResultS = @mysql_fetch_array($this->QueryID);
 }
 function Seek($seek){
  if(!$this->QueryID) return 0;
  @mysql_data_seek($this->QueryID,$seek);
 }
 function Query($Sql){//执行查询
  if($Sql == "") return 0;
  if($this->LinkID == 0) $this->Connect();
  if($this->QueryID) $this->Free();//释放原来查询结果
  $this->QueryID = @mysql_query($Sql,$this->LinkID);
  $this->Error = mysql_error($this->LinkID);
  if(!$this->QueryID) exit("$Sql执行失败."); 
  return $this->QueryID; 
 }
 function GetRecord($Name){
  if(!$this->QueryID) return 0;
  return $this->ResultS[$Name];
 }
}
?>

[!--infotagslink--]

相关文章

  • Mybatis Plus select 实现只查询部分字段

    这篇文章主要介绍了Mybatis Plus select 实现只查询部分字段的操作,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教...2021-09-01
  • 不打开网页直接查看网站的源代码

      有一种方法,可以不打开网站而直接查看到这个网站的源代码..   这样可以有效地防止误入恶意网站...   在浏览器地址栏输入:   view-source:http://...2016-09-20
  • php 调用goolge地图代码

    <?php require('path.inc.php'); header('content-Type: text/html; charset=utf-8'); $borough_id = intval($_GET['id']); if(!$borough_id){ echo ' ...2016-11-25
  • JS基于Mootools实现的个性菜单效果代码

    本文实例讲述了JS基于Mootools实现的个性菜单效果代码。分享给大家供大家参考,具体如下:这里演示基于Mootools做的带动画的垂直型菜单,是一个初学者写的,用来学习Mootools的使用有帮助,下载时请注意要将外部引用的mootools...2015-10-23
  • JS+CSS实现分类动态选择及移动功能效果代码

    本文实例讲述了JS+CSS实现分类动态选择及移动功能效果代码。分享给大家供大家参考,具体如下:这是一个类似选项卡功能的选择插件,与普通的TAb区别是加入了动画效果,多用于商品类网站,用作商品分类功能,不过其它网站也可以用,...2015-10-21
  • JS实现自定义简单网页软键盘效果代码

    本文实例讲述了JS实现自定义简单网页软键盘效果。分享给大家供大家参考,具体如下:这是一款自定义的简单点的网页软键盘,没有使用任何控件,仅是为了练习JavaScript编写水平,安全性方面没有过多考虑,有顾虑的可以不用,目的是学...2015-11-08
  • php 取除连续空格与换行代码

    php 取除连续空格与换行代码,这些我们都用到str_replace与正则函数 第一种: $content=str_replace("n","",$content); echo $content; 第二种: $content=preg_replac...2016-11-25
  • MyBatisPlus-QueryWrapper多条件查询及修改方式

    这篇文章主要介绍了MyBatisPlus-QueryWrapper多条件查询及修改方式,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教...2022-06-27
  • php简单用户登陆程序代码

    php简单用户登陆程序代码 这些教程很对初学者来讲是很有用的哦,这款就下面这一点点代码了哦。 <center> <p>&nbsp;</p> <p>&nbsp;</p> <form name="form1...2016-11-25
  • PHP实现清除wordpress里恶意代码

    公司一些wordpress网站由于下载的插件存在恶意代码,导致整个服务器所有网站PHP文件都存在恶意代码,就写了个简单的脚本清除。恶意代码示例...2015-10-23
  • Oracle使用like查询时对下划线的处理方法

    这篇文章主要介绍了Oracle使用like查询时对下划线的处理方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2021-03-16
  • JS实现双击屏幕滚动效果代码

    本文实例讲述了JS实现双击屏幕滚动效果代码。分享给大家供大家参考,具体如下:这里演示双击滚屏效果代码的实现方法,不知道有觉得有用处的没,现在网上还有很多还在用这个特效的呢,代码分享给大家吧。运行效果截图如下:在线演...2015-10-30
  • js识别uc浏览器的代码

    其实挺简单的就是if(navigator.userAgent.indexOf('UCBrowser') > -1) {alert("uc浏览器");}else{//不是uc浏览器执行的操作}如果想测试某个浏览器的特征可以通过如下方法获取JS获取浏览器信息 浏览器代码名称:navigator...2015-11-08
  • 解决mybatis-plus 查询耗时慢的问题

    这篇文章主要介绍了解决mybatis-plus 查询耗时慢的问题,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教...2021-07-04
  • JS日期加减,日期运算代码

    一、日期减去天数等于第二个日期function cc(dd,dadd){//可以加上错误处理var a = new Date(dd)a = a.valueOf()a = a - dadd * 24 * 60 * 60 * 1000a = new Date(a)alert(a.getFullYear() + "年" + (a.getMonth() +...2015-11-08
  • PHP开发微信支付的代码分享

    微信支付,即便交了保证金,你还是处理测试阶段,不能正式发布。必须到你通过程序测试提交订单、发货通知等数据到微信的系统中,才能申请发布。然后,因为在微信中是通过JS方式调用API,必须在微信后台设置支付授权目录,而且要到...2014-05-31
  • PHP常用的小程序代码段

    本文实例讲述了PHP常用的小程序代码段。分享给大家供大家参考,具体如下:1.计算两个时间的相差几天$startdate=strtotime("2009-12-09");$enddate=strtotime("2009-12-05");上面的php时间日期函数strtotime已经把字符串...2015-11-24
  • 几种延迟加载JS代码的方法加快网页的访问速度

    本文介绍了如何延迟javascript代码的加载,加快网页的访问速度。 当一个网站有很多js代码要加载,js代码放置的位置在一定程度上将会影像网页的加载速度,为了让我们的网页加载速度更快,本文总结了一下几个注意点...2013-10-13
  • php怎么用拼音 简单的php中文转拼音的实现代码

    小编分享了一段简单的php中文转拼音的实现代码,代码简单易懂,适合初学php的同学参考学习。 代码如下 复制代码 <?phpfunction Pinyin($_String...2017-07-06
  • php导出csv格式数据并将数字转换成文本的思路以及代码分享

    php导出csv格式数据实现:先定义一个字符串 存储内容,例如 $exportdata = '规则111,规则222,审222,规222,服2222,规则1,规则2,规则3,匹配字符,设置时间,有效期'."/n";然后对需要保存csv的数组进行foreach循环,例如复制代...2014-06-07