php小偷程序实例代码

 更新时间:2016年11月25日 16:22  点击:1396
小偷程序其实就是利用了php中的一特定函数实现采集别人网站的内容,然后通过正则分析把我们想要的内容保存到自己本地数据库了,下面我来介绍php小偷程序的实现方法,有需要的朋友可参考。

在下面采集数据过程中file_get_contents函数是关键了,下面我们来看看file_get_contents函数语法

string file_get_contents ( string $filename [, bool $use_include_path = false [, resource $context [, int $offset = -1 [, int $maxlen ]]]] )
和 file() 一样,只除了 file_get_contents() 把文件读入一个字符串。将在参数 offset 所指定的位置开始读取长度为 maxlen 的内容。如果失败, file_get_contents() 将返回 FALSE。

file_get_contents() 函数是用来将文件的内容读入到一个字符串中的首选方法。如果操作系统支持还会使用内存映射技术来增强性能。

 代码如下 复制代码

<?php
$homepage = file_get_contents('http://www.111cn.net/');
echo $homepage;
?>

这样$homepage就是我们采集网的内容给保存下来了,好了说了这么多我们开始吧。

 代码如下 复制代码

<?php

function fetch_urlpage_contents($url){
$c=file_get_contents($url);
return $c;
}
//获取匹配内容
function fetch_match_contents($begin,$end,$c)
{
$begin=change_match_string($begin);
$end=change_match_string($end);
$p = "{$begin}(.*){$end}";
if(eregi($p,$c,$rs))
{
return $rs[1];}
else { return "";}
}//转义正则表达式字符串
function change_match_string($str){
//注意,以下只是简单转义
//$old=array("/","$");
//$new=array("/","$");
$str=str_replace($old,$new,$str);
return $str;
}

//采集网页
function pick($url,$ft,$th)
{
$c=fetch_urlpage_contents($url);
foreach($ft as $key => $value)
{
$rs[$key]=fetch_match_contents($value["begin"],$value["end"],$c);
if(is_array($th[$key]))
{ foreach($th[$key] as $old => $new)
{
$rs[$key]=str_replace($old,$new,$rs[$key]);
}
}
}
return $rs;
}

$url="http://www.111cn.net"; //要采集的地址
$ft["title"]["begin"]="<title>"; //截取的开始点
$ft["title"]["end"]="</title>"; //截取的结束点
$th["title"]["中山"]="广东"; //截取部分的替换

$ft["body"]["begin"]="<body>"; //截取的开始点
$ft["body"]["end"]="</body>"; //截取的结束点
$th["body"]["中山"]="广东"; //截取部分的替换

$rs=pick($url,$ft,$th); //开始采集

echo $rs["title"];
echo $rs["body"]; //输出
?>

以下代码从上一面修改而来,专门用于提取网页所有超链接,邮箱或其他特定内容

 代码如下 复制代码

<?php

function fetch_urlpage_contents($url){
$c=file_get_contents($url);
return $c;
}
//获取匹配内容
function fetch_match_contents($begin,$end,$c)
{
$begin=change_match_string($begin);
$end=change_match_string($end);
$p = "#{$begin}(.*){$end}#iU";//i表示忽略大小写,U禁止贪婪匹配
if(preg_match_all($p,$c,$rs))
{
return $rs;}
else { return "";}
}//转义正则表达式字符串
function change_match_string($str){
//注意,以下只是简单转义
$old=array("/","$",'?');
$new=array("/","$",'?');
$str=str_replace($old,$new,$str);
return $str;
}

//采集网页
function pick($url,$ft,$th)
{
$c=fetch_urlpage_contents($url);
foreach($ft as $key => $value)
{
$rs[$key]=fetch_match_contents($value["begin"],$value["end"],$c);
if(is_array($th[$key]))
{ foreach($th[$key] as $old => $new)
{
$rs[$key]=str_replace($old,$new,$rs[$key]);
}
}
}
return $rs;
}

$url="http://www.111cn.net"; //要采集的地址
$ft["a"]["begin"]='<a'; //截取的开始点<br />
$ft["a"]["end"]='>'; //截取的结束点

$rs=pick($url,$ft,$th); //开始采集

print_r($rs["a"]);

?>

小提示file_get_contents很是容易被防采集了,我们可以使用curl来模仿用户对网站进行访问,这算比上面要高级不少哦,file_get_contents()效率稍低些,常用失败的情况、curl()效率挺高的,支持多线程,不过需要开启下curl扩展。下面是curl扩展开启的步骤:

1、将PHP文件夹下的三个文件php_curl.dll,libeay32.dll,ssleay32.dll复制到system32下;

2、将php.ini(c:WINDOWS目录下)中的;extension=php_curl.dll中的分号去掉;

3、重启apache或者IIS。

简单的抓取页面函数,附带伪造 Referer 和 User_Agent 功能

 代码如下 复制代码

<?php
function GetSources($Url,$User_Agent='',$Referer_Url='') //抓取某个指定的页面
{
//$Url 需要抓取的页面地址
//$User_Agent 需要返回的user_agent信息 如“baiduspider”或“googlebot”
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $Url);
curl_setopt ($ch, CURLOPT_USERAGENT, $User_Agent);
curl_setopt ($ch, CURLOPT_REFERER, $Referer_Url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$MySources = curl_exec ($ch);
curl_close($ch);
return $MySources;
}
$Url = "http://www.111cn.net"; //要获取内容的也没
$User_Agent = "baiduspider+(+http://www.baidu.com/search/spider.htm)";
$Referer_Url = 'http://www.111cn.net/';
echo GetSources($Url,$User_Agent,$Referer_Url);
?>

php本身是不具备可以带有实时上传进度条功能了,如果想有这种功能我们一般会使用ajax来实现,但是php提供了一个apc,他就可以与php配置实现上传进度条哦。

主要针对的是window上的应用。
1.服务器要支持apc扩展,没有此扩展的话,百度一下php_apc.dll ,下载一个扩展扩展要求php.5.2以上。
2.配置apc相关配置,重启apache

 代码如下 复制代码
extension=php_apc.dll  
apc.rfc1867 = on  
apc.max_file_size = 1000M  
upload_max_filesize = 1000M  
post_max_size = 1000M  

 

说明一下:至于参数要配多大,得看项目需要apc.max_file_size,  设置apc所支持上传文件的大小,要求apc.max_file_size <=upload_max_filesize  并且apc.max_file_size <=post_max_size.重新启动apache即可实现apc的支持.
3.在代码里面利用phpinfo();查看apc扩展安装了没有。
4.下面是实现代码:
getprogress.php

 代码如下 复制代码

<?php  
session_start();  
if(isset($_GET['progress_key'])) {  
  $status = apc_fetch('upload_'.$_GET['progress_key']);  
  echo ($status['current']/$status['total'])*100;  
}  
?>  
upload.php

PHP Code
<?php  
   $id = $_GET['id'];  
?>  
<form enctype="multipart/form-data" id="upload_form" action="target.php" method="POST">  
<input type="hidden" name="APC_UPLOAD_PROGRESS"   
       id="progress_key"  value="<?php echo $id?>"/>  
<input type="file" id="test_file" name="test_file"/><br/>  
<input onclick="window.parent.startProgress(); return true;"  
 type="submit" value="上传"/>  
</form>  

target.php

 代码如下 复制代码
<?php    
set_time_limit(600);  
if($_SERVER['REQUEST_METHOD']=='POST') {  
  move_uploaded_file($_FILES["test_file"]["tmp_name"],   
  dirname($_SERVER['SCRIPT_FILENAME'])."/UploadTemp/" . $_FILES["test_file"]["name"]);//UploadTemp文件夹位于此脚本相同目录下  
  echo "<p>上传成功</p>";  
}  
?>  

index.php

 代码如下 复制代码

<?php  
   $id = md5(uniqid(rand(), true));  
?>  
<html>  
<head><title>上传进度</title></head>  
<body>  
<script src="js/jquery-1.4.4.min.js" language="javascript"></script>  
  
  
<script language="javascript">  
var proNum=0;  
var loop=0;  
var progressResult;  
function sendURL() {  
            $.ajax({  
                        type : 'GET',  
                        url : "getprogress.php?progress_key=<?php echo $id;?>",  
                        async : true,  
                        cache : false,  
                        dataType : 'json',  
                        data: "progress_key=<?php echo $id;?>",  
                        success : function(e) {  
                                     progressResult = e;  
                                      proNum=parseInt(progressResult);  
                                      document.getElementById("progressinner").style.width = proNum+"%";  
                                      document.getElementById("showNum").innerHTML = proNum+"%";  
                                      if ( proNum < 100){  
                                        setTimeout("getProgress()", 100);  
                                      }   
                                   
                        }  
            });  
    
}  
  
function getProgress(){  
 loop++;  
  
 sendURL();  
}  
var interval;  
function startProgress(){  
    document.getElementById("progressouter").style.display="block";  
   setTimeout("getProgress()", 100);  
}  
</script>  
<iframe id="theframe" name="theframe"   
        src="upload.php?id=<?php echo $id; ?>"   
        style="border: none; height: 100px; width: 400px;" >   
</iframe>  
<br/><br/>  
<div id="progressouter" style="width: 500px; height: 20px; border: 6px solid red; display:none;">  
   <div id="progressinner" style="position: relative; height: 20px; background-color: purple; width: 0%; "></div>  
</div>  
<div id='showNum'></div><br>  
<div id='showNum2'></div>  
</body>  
</html>  

本人给大家推一个不错php文件缓存类文件,从各方面来看本缓存类很合理并且适用于大型网站使用哦,有需要的朋友可参考参考。
 代码如下 复制代码

<?php
class Cache {
 /** 缓存目录 **/
 var $CacheDir        = './c';
 /** 缓存的文件 **/
 var $CacheFile        = '';
 /** 文件缓存时间(分钟) **/
 var $CacheTime        = 0;
 /** 文件是否已缓存 **/
 var $CacheFound        = False;
 /** 错误及调试信息 **/
 var $DebugMsg        = NULL;

 function Cache($CacheTime = 0) {
  $this->CacheTime    = $CacheTime;
 }

 private function Run() {
  /** 缓存时间大于0,检测缓存文件的修改时间,在缓存时间内为缓存文件名,超过缓存时间为False,
                小于等于0,返回false,并清理已缓存的文件
         **/
  Return $this->CacheTime ? $this->CheckCacheFile() : $this->CleanCacheFile();
 }
 function GetCache($VistUrl,$CacheFileType = 'html')
 {
  $this->SetCacheFile($VistUrl,$CacheFileType);

  $fileName=$this->CheckCacheFile();
  if($fileName)
  {
   $fp = fopen($fileName,"r");
   $content_= fread($fp, filesize($fileName));
   fclose($fp);
   return $content_;
  }
  else
  {
   return false;
  }
 }
 private function SetCacheFile($VistUrl,$CacheFileType = 'html') {
  if(empty($VistUrl)) {
   /** 默认为index.html **/
   $this->CacheFile = 'index';
  }else {
   /** 传递参数为$_POST时 **/
   $this->CacheFile = is_array($VistUrl) ? implode('.',$VistUrl) : $VistUrl;
  }
  $this->CacheFile = $this->CacheDir.'/'.md5($this->CacheFile);
  $this->CacheFile.= '.'.$CacheFileType;
 }

 function SetCacheTime($t = 60) {
  $this->CacheTime = $t;
 }

 private function CheckCacheFile() {
  if(!$this->CacheTime || !file_exists($this->CacheFile)) {Return False;}
  /** 比较文件的建立/修改日期和当前日期的时间差 **/
  $GetTime=(Time()-Filemtime($this->CacheFile))/(60*1);
  /** Filemtime函数有缓存,注意清理 **/
  Clearstatcache();
  $this->Debug('Time Limit '.($GetTime*60).'/'.($this->CacheTime*60).'');
  $this->CacheFound = $GetTime <= $this->CacheTime ? $this->CacheFile : False;
  Return $this->CacheFound;
 }

 function SaveToCacheFile($VistUrl,$Content,$CacheFileType = 'html') {
  $this->SetCacheFile($VistUrl,$CacheFileType);
  if(!$this->CacheTime) {
   Return False;
  }
  /** 检测缓存目录是否存在 **/
  if(true === $this->CheckCacheDir()) {
   $CacheFile = $this->CacheFile;
   $CacheFile = str_replace('//','/',$CacheFile);
   $fp = @fopen($CacheFile,"wb");
   if(!$fp) {
    $this->Debug('Open File '.$CacheFile.' Fail');
   }else {
    if(@!fwrite($fp,$Content)){
     $this->Debug('Write '.$CacheFile.' Fail');
    }else {
     $this->Debug('Cached File');
    };
    @fclose($fp);
   }
  }else {
   /** 缓存目录不存在,或不能建立目录 **/
   $this->Debug('Cache Folder '.$this->CacheDir.' Not Found');
  }
 }

 private function CheckCacheDir() {
  if(file_exists($this->CacheDir)) { Return true; }
  /** 保存当前工作目录 **/
  $Location = getcwd();
  /** 把路径划分成单个目录 **/
  $Dir = split("/", $this->CacheDir);
  /** 循环建立目录 **/
  $CatchErr = True;
  for ($i=0; $i<count($Dir); $i++){
   if (!file_exists($Dir[$i])){
    /** 建立目录失败会返回False 返回建立最后一个目录的返回值 **/
    $CatchErr = @mkdir($Dir[$i],0777);
   }
   @chdir($Dir[$i]);
  }
  /** 建立完成后要切换到原目录 **/
  chdir($Location);
  if(!$CatchErr) {
   $this->Debug('Create Folder '.$this->CacheDir.' Fail');
  }
  Return $CatchErr;
 }

 private function CleanCacheFile() {
  if(file_exists($this->CacheFile)) {
   @chmod($this->CacheFile,777);
   @unlink($this->CacheFile);
  }
  /** 置没有缓存文件 **/
  $this->CacheFound = False;
  Return $this->CacheFound;
 }

 function Debug($msg='') {
  if(DEBUG) {
   $this->DebugMsg[] = '[Cache]'.$msg;
  }
 }

 function GetError() {
  Return empty($this->DebugMsg) ? '' : "<br>n".implode("<br>n",$this->DebugMsg);
 }
}/* end of class */


?>

在php中我们也有可以直接来操作ftp,然后利用php实现与ftp一样的文件上传与下载文件的功能哦,下面我来介绍一个完整的实例。

一、LycFtpAbstract.class.php   FTP基类

 代码如下 复制代码
<?php
    /*  author:凹凸曼(lyc)
    /*  email: jar-c@163.com
    /*  time : 2011-04-22
    */
 
abstract class Lyc_Ftp_Abstract {
 
    protected $ftpobj=null;
    protected $host='';
    protected $user='anonymous';
    protected $pwd='';
    protected $mode=FTP_BINARY;
    protected $port=21;
    protected $timeout=90;
 
    protected $pasv=TRUE;
 
    protected function init(){
 
    }
    /**
    * 建立ftp连接
    *
    */
    protected function connect(){
       $this->ftpobj=@ftp_connect($this->host,$this->port,$this->timeout);
       if(null==$this->ftpobj){
        require_once 'Lyc/Ftp/Exception.class.php';
       throw new Lyc_Ftp_Exception("FTP ERROR : Couldn't connect to $this->host");
       }
    }
    /**
    * 建立ssl ftp连接
    *
    */
    protected function connectSsl(){
       $ftpobj=@ftp_ssl_connect($this->host,$this->port,$this->timeout);
       if(null==$ftpobj){
        require_once 'Lyc/Ftp/Exception.class.php';
       throw new Lyc_Ftp_Exception("FTP ERROR : Couldn't connect to $this->host");
       }
    }
    /**
    * 登录验证ftp 及设置模式
    *
    */
    protected function login(){
 
        if(@ftp_login($this->ftpobj,$this->user,$this->pwd)){
            ftp_pasv($this->ftpobj,$pasv);
 
        }else{
            require_once 'Lyc/Ftp/Exception.class.php';
            throw new Lyc_Ftp_Exception("FTP ERROR : Couldn't login to $this->host");
        }
    }
    /**
    * 上传文件
    *
    */
    public function upload($remotefile,$localfile){
 
    }
    /**
    * 下载文件
    *
    */
    public function download($localfile,$remotefile){
 
    }
    /**
    * 关闭连接
    *
    */
    public function close(){
        if(is_string($this->ftpobj)){
            ftp_close($this->ftpobj);
        }
    }
 
}
?>

 
 
二、LycFtpFtp.class.php   实现类

 代码如下 复制代码
 <?php
    /*  author:凹凸曼(lyc)
    /*  email: jar-c@163.com
    /*  time : 2011-04-22
    /*
    */
require_once 'Lyc/Ftp/Abstract.class.php';
class Lyc_Ftp_Ftp extends Lyc_Ftp_Abstract{
 
    public function __construct($host,$user,$pwd,$mode=FTP_BINARY,$port=21,$timeout=90,$pasv=TRUE){
        $this->host=$host;
        $this->user=$user;
        $this->pwd=$pwd;
        $this->mode=$mode;
        $this->port=$port;
        $this->timeout=$timeout;
        $this->pasv=$pasv;
        $this->init();
 
    }
    protected function init(){
 
            $this->connect();
            $this->login();
 
    }
    /**
    * 上传文件
    *
    */
    public function upload($remotefile,$localfile){
 
       $res=ftp_nb_put($this->ftpobj,$remotefile,$localfile,$this->mode,ftp_size($this->ftpobj,$remotefile));
       while($res==FTP_MOREDATA){
           $res=ftp_nb_continue($this->ftpobj);
       }
       if($res!=FTP_FINISHED){
           return FALSE;
       }
       return TRUE;
    }
    /**
    * 下载文件
    *
    */
    public function download($localfile,$remotefile){
        ftp_set_option($this->ftpobj,FTP_AUTOSEEK,FALSE);
        $res=ftp_nb_get($this->ftpobj,$localfile,$remotefile,$this->mode,ftp_size($this->ftpobj,$localfile));
        while($res==FTP_MOREDATA){
            $res=ftp_nb_continue($this->ftpobj);
        }
        if($res!=FTP_FINISHED){
            return FALSE;
        }
        return TRUE;
    }
}
?>

 
三、LycException.class.php  异常基类

 代码如下 复制代码
 <?php
    /*  author:凹凸曼(lyc)
    /*  email: jar-c@163.com
    /*  time : 2011-04-22
    /*  
 
    */
    class Lyc_Exception extends Exception{
 
    }
?>
 


四、LycFtpException.class.php  FTP异常类

 

 代码如下 复制代码
 <?php
    /*  author:凹凸曼(lyc)
    /*  email: jar-c@163.com
    /*  time : 2011-04-22
    */
require_once 'Lyc/Exception.class.php';
class Lyc_Ftp_Exception extends Lyc_Exception{
 
}
?>
 


五、测试区

 代码如下 复制代码


 <?php
   /**
    * 上传文件
    *
    */
    public  function uploadTest(){
        require_once 'Lyc/Ftp/Ftp.class.php';
        $host=23.64.41.13';     //主机
        $user='tguser';                //用户名
        $pwd="";                         //密码   端口默认21 也可改
        $ftp=new Lyc_Ftp_Ftp($host,$user,$pwd);
        $res=$ftp->upload('test.rar',"F:\wwwroot\testarea\Lyc\Test\test.rar");
        if(!$res){
            echo " upload failure";
        }
 
    }
 
    public function downloadTest(){
        require_once 'Lyc/Ftp/Ftp.class.php';
        $host=33.64.41.135';
        $user='tguser';
        $pwd="";
        $ftp=new Lyc_Ftp_Ftp($host,$user,$pwd);
        $res=$ftp->download("c:\test.rar","test.rar");
        if(!$res){
            echo "download failure";
        }
 
    }

fsockopen是php中一个比较实用的函数了,下面我来介绍利用fsockopen函数来采集网页的程序,有需要的朋友可参考。

用法
int fsockopen(string hostname, int port, int [errno], string [errstr], int [timeout]);

一个采集网页实例

 代码如下 复制代码

<?php
function get_url ($url,$cookie=false)
{
$url = parse_url($url);
$query = $url[path].”?”.$url[query];
echo “Query:”.$query;
$fp = fsockopen( $url[host], $url[port]?$url[port]:80 , $errno, $errstr, 30);
if (!$fp) {
return false;
} else {
$request = “GET $query HTTP/1.1rn”;
$request .= “Host: $url[host]rn”;
$request .= “Connection: Closern”;
if($cookie) $request.=”Cookie:   $cookien”;
$request.=”rn”;
fwrite($fp,$request);
while(!@feof($fp)) {
$result .= @fgets($fp, 1024);
}
fclose($fp);
return $result;
}
}
//获取url的html部分,去掉header
function GetUrlHTML($url,$cookie=false)
{
$rowdata = get_url($url,$cookie);
if($rowdata)
{
$body= stristr($rowdata,”rnrn”);
$body=substr($body,4,strlen($body));
return $body;
}

    return false;
}
?>

被禁用后的解决方法

服务器同时禁用了fsockopen pfsockopen,那么用其他函数代替,如stream_socket_client()。注意:stream_socket_client()和fsockopen()的参数不同。

fsockopen( 替换为 stream_socket_client( ,然后,将原fsockopen函数中的端口参数“80”删掉,并加到$host。

 代码如下 复制代码

$fp = fsockopen($host, 80, $errno, $errstr, 30);

$fp = fsockopen($host, $port, $errno, $errstr, $connection_timeout);
修改后:
$fp = stream_socket_client("tcp://".$host."80", $errno, $errstr, 30);

$fp = stream_socket_client("tcp://".$host.":".$port, $errno, $errstr, $connection_timeout);

[!--infotagslink--]

相关文章

  • C#开发Windows窗体应用程序的简单操作步骤

    这篇文章主要介绍了C#开发Windows窗体应用程序的简单操作步骤,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2021-04-12
  • C++调用C#的DLL程序实现方法

    本文通过例子,讲述了C++调用C#的DLL程序的方法,作出了以下总结,下面就让我们一起来学习吧。...2020-06-25
  • 不打开网页直接查看网站的源代码

      有一种方法,可以不打开网站而直接查看到这个网站的源代码..   这样可以有效地防止误入恶意网站...   在浏览器地址栏输入:   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
  • 微信小程序 页面传值详解

    这篇文章主要介绍了微信小程序 页面传值详解的相关资料,需要的朋友可以参考下...2017-03-13
  • JS基于Mootools实现的个性菜单效果代码

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

    本文通过两个示例讲解了一下Process类调用外部应用程序的基本用法,并简单讲解了StartInfo属性,有需要的朋友可以参考一下。...2020-06-25
  • 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
  • php简单用户登陆程序代码

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

    公司一些wordpress网站由于下载的插件存在恶意代码,导致整个服务器所有网站PHP文件都存在恶意代码,就写了个简单的脚本清除。恶意代码示例...2015-10-23
  • 使用GruntJS构建Web程序之构建篇

    大概有如下步骤 新建项目Bejs 新建文件package.json 新建文件Gruntfile.js 命令行执行grunt任务 一、新建项目Bejs源码放在src下,该目录有两个js文件,selector.js和ajax.js。编译后代码放在dest,这个grunt会...2014-06-07
  • JS实现双击屏幕滚动效果代码

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

    这篇文章主要介绍了uniapp微信小程序:key失效的解决方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2021-01-20
  • js识别uc浏览器的代码

    其实挺简单的就是if(navigator.userAgent.indexOf('UCBrowser') > -1) {alert("uc浏览器");}else{//不是uc浏览器执行的操作}如果想测试某个浏览器的特征可以通过如下方法获取JS获取浏览器信息 浏览器代码名称:navigator...2015-11-08
  • 微信小程序二维码生成工具 weapp-qrcode详解

    这篇文章主要介绍了微信小程序 二维码生成工具 weapp-qrcode详解,教大家如何在项目中引入weapp-qrcode.js文件,通过实例代码给大家介绍的非常详细,需要的朋友可以参考下...2021-10-23
  • 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
  • 将c#编写的程序打包成应用程序的实现步骤分享(安装,卸载) 图文

    时常会写用c#一些程序,但如何将他们和photoshop一样的大型软件打成一个压缩包,以便于发布....2020-06-25