php 多态与接口学习实现与实例代码

 更新时间:2016年11月25日 16:25  点击:1597

php教程5中,变量的类型是不确定的,一个变量可以指向任何类型的数值、字符串、对象、资源等。我们无法说php5中多态的是变量。

我们只能说在php5中,多态应用在方法参数的类型提示位置。

一个类的任何子类对象都可以满足以当前类型作为类型提示的类型要求。所有实现这个接口的类,都可以满足以接口类型作为类型提示的方法参数要求。简单的说,一个类拥有其父类、和已实现接口的身份

通过实现接口实现多态
下面的例子中,useradmin类的静态方法,要求一个user类型的参数。

在后面的使用中,传递了一个实现了user接口的类normaluser的实例。代码成功运行。

<?
interface user{ // user接口
 public function  getname();
 public function setname($_name);
}

class normaluser implements user { // 实现接口的类.
 private $name;
 public function getname(){
  return $this->name;
 }
 public function setname($_name){
  $this->name = $_name;
 }
}

class useradmin{ //操作.
 public static function  changeusername(user $_user,$_username){
  $_user->setname($_username);
 }
}

$normaluser = new normaluser();
useradmin::changeusername($normaluser,"tom");//这里传入的是 normaluser的实例.
echo $normaluser->getname();
?>


php 接口类:interface

其实他们的作用很简单,当有很多人一起开发一个项目时,可能都会去调用别人写的一些类,那你就会问,我怎么知道他的某个功能的实现方法是怎么命名的呢,这个时候php接口类就起到作用了,当我们定义了一个接口类时,它里面的方式是下面的子类必须实现的,比如 :

代码如下:

interface shop
{
public function buy($gid);
public function sell($gid);
public function view($gid);
}

我声明一个shop接口类,定义了三个方法:买(buy),卖(sell),看(view),那么继承此类的所有子类都必须实现这3个方法少一个都不行,如果子类没有实现这些话,就无法运行。实际上接口类说白了,就是一个类的模板,一个类的规定,如果你属于这类,你就必须遵循我的规定,少一个都不行,但是具体你怎么去做,我不管,那是你的事,如:

代码如下:

class baseshop implements shop
{
public function buy($gid)
{
echo('你购买了id为 :'.$gid.'的商品');
}
public function sell($gid)
{
echo('你卖了id为 :'.$gid.'的商品');
}
public function view($gid)
{
echo('你查看了id为 :'.$gid.'的商品');
}
}


下面缩一下方法

<?php 
interface myusbkou 

    function type();//类型 
    function action();//执行的操作 

class zip implements myusbkou 
{  //继承接口 
    function type()
    { 
        echo "usb的2.0接口"; 
    } 
    function action()
    { 
        echo "--->需要usb 2.0驱动"; 
    } 

class mp3 implements myusbkou

    function type() 
    { 
     echo "mp3的1.0接口"; 
    } 
    function action() 
    { 
     echo "--->需要mp3 1.0驱动<br/>"; 
    } 

class mypc

    function usbthing($thing) 
    { 
        $thing->type(); 
        $thing->action(); 
    } 

$p=new mypc(); 
$mp3=new mp3(); 
$zip=new zip(); 
$p->usbthing($mp3); 
$p->usbthing($zip); 
?>

upload_err_ok              no error occurred.

上传成功
 
upload_err_ini_size        the uploaded file exceeds the maximum value specified in the php教程.ini file.
超出最大上传尺寸

upload_err_form_size       the uploaded file exceeds the maximum value specified by the max_file_size hidden widget.
超出form设置最大上传尺寸
 
upload_err_partial         the file upload was canceled and only part of the file was uploaded.
 
upload_err_nofile          no file was uploaded.

未上传文件

<html>
<head>
<title>a simple file upload form</title>
</head>
<body>
<form enctype="multipart/form-data"
   action="<?print $_server['php_self']?>" method="post">
<p>
<input type="hidden" name="max_file_size" value="102400" />
<input type="file" name="fupload" /><br/>
<input type="submit" value="upload!" />
</p>
</form>
</body>
</html>

实例一

]<html>
 <head>
 <title>a file upload script</title>
 </head>
 <body>
 <div>
 <?php
 if ( isset( $_files['fupload'] ) ) {

     print "name: ".     $_files['fupload']['name']       ."<br />";
     print "size: ".     $_files['fupload']['size'] ." bytes<br />";
     print "temp name: ".$_files['fupload']['tmp_name']   ."<br />";
     print "type: ".     $_files['fupload']['type']       ."<br />";
     print "error: ".    $_files['fupload']['error']      ."<br />";

     if ( $_files['fupload']['type'] == "image/gif" ) {

         $source = $_files['fupload']['tmp_name'];
         $target = "upload/".$_files['fupload']['name'];
         move_uploaded_file( $source, $target );// or die ("couldn't copy");
         $size = getimagesize( $target );

         $imgstr = "<p><img width="$size[0]" height="$size[1]" ";
         $imgstr .= "src="$target" alt="uploaded image" /></p>";

         print $imgstr;
     }
 }
 ?>
 </div>
 <form enctype="multipart/form-data"
     action="<?php print $_server['php_self']?>" method="post">
 <p>
 <input type="hidden" name="max_file_size" value="102400" />
 <input type="file" name="fupload" /><br/>
 <input type="submit" value="upload!" />
 </p>
 </form>
 </body>
 </html>

文件上传实例二

<?php
$maxsize=28480;
if (!$http_post_vars['submit']) {
    $error=" ";
}
if (!is_uploaded_file($http_post_files['upload_file']['tmp_name']) and !isset($error)) {
    $error = "<b>you must upload a file!</b><br /><br />";
    unlink($http_post_files['upload_file']['tmp_name']);
}
if ($http_post_files['upload_file']['size'] > $maxsize and !isset($error)) {
    $error = "<b>error, file must be less than $maxsize bytes.</b><br /><br />";
    unlink($http_post_files['upload_file']['tmp_name']);
}
if (!isset($error)) {
    move_uploaded_file($http_post_files['upload_file']['tmp_name'],
                       "uploads/".$http_post_files['upload_file']['name']);
    print "thank you for your upload.";
    exit;
}
else
{
    echo ("$error");
}
?>

<html>
<head></head>
<body>
<form action="<?php echo(htmlspecialchars($_server['php_self']))?>"
method="post" enctype="multipart/form-data">
    choose a file to upload:<br />
    <input type="file" name="upload_file" size="80">
    <br />
    <input type="submit" name="submit" value="submit">
</form>
</body>
</html>

如果你看到的话,那么你需要设置你的php教程并开启这个库。如果你是在windows平台下,那么非常简单,你需要改一改你的php.ini文件的设置,找到php_curl.dll,并取消前面的分号注释就行了。如下所示:
//取消下在的注释
extension=php_curl.dll

  如果你是在linux下面,那么,google排名你需要重新编译你的php了,编辑时,你需要打开编译参数——在configure命令上加上“–with-curl” 参数。
  一个小示例
  如果一切就绪,下面是一个小例程:
复制代码 代码如下:

<?php
// 初始化一个 curl 对象
$curl = curl_init();
// 设置你需要抓取的url
curl_setopt($curl, curlopt_url, 'http://111cn.net');
// 设置header
curl_setopt($curl, curlopt_header, 1);
// 设置curl 参数,要求结果保存到字符串中还是输出到屏幕上。
curl_setopt($curl, curlopt_returntransfer, 1);
// 运行curl,请求网页
$data = curl_exec($curl);
// 关闭url请求
curl_close($curl);
// 显示获得的数据
var_dump($data);

  如何post数据
  上面是抓取网页的代码,下面则是向某个网页post数据。假设我们有一个处理表单的网址http://www.example.com/sendsms.php,其可以接受两个表单域,一个是电话号码,一个是短信内容。
复制代码 代码如下:

<?php
$phonenumber = '13912345678';
$message = 'this message was generated by curl and php';
$curlpost = 'pnumber=' . urlencode($phonenumber) . '&message=' . urlencode($message) . '&submit=send';
$ch = curl_init();chain link fencing
curl_setopt($ch, curlopt_url, 'http://www.example.com/sendsms.php');
curl_setopt($ch, curlopt_header, 1);
curl_setopt($ch, curlopt_returntransfer, 1);
curl_setopt($ch, curlopt_post, 1);
curl_setopt($ch, curlopt_postfields, $curlpost);
$data = curl_exec();
curl_close($ch);
?>

  从上面的程序我们可以看到,使用curlopt_post设置http协议的post方法,而不是get方法,然后以curlopt_postfields设置post的数据。
  关于代理服务器
  下面是一个如何使用代理服务器的示例。请注意其中高亮的代码,代码很简单,我就不用多说了。
复制代码 代码如下:

<?php
$ch = curl_init();
curl_setopt($ch, curlopt_url, 'http://www.example.com');
curl_setopt($ch, curlopt_header, 1);
curl_setopt($ch, curlopt_returntransfer, 1);
curl_setopt($ch, curlopt_httpproxytunnel, 1);
curl_setopt($ch, curlopt_proxy, 'fakeproxy.com:1080');
curl_setopt($ch, curlopt_proxyuserpwd, 'user:password');
$data = curl_exec();
curl_close($ch);
?>


  
  关于ssl和cookie
  关于ssl也就是https教程协议,煤气发生炉你只需要把curlopt_url连接中的http://变成https://就可以了。当然,还有一个参数叫curlopt_ssl_verifyhost可以设置为验证站点。
  关于cookie,你需要了解下面三个参数:
  curlopt_cookie,在当面的会话中设置一个cookie
  curlopt_cookiejar,当会话结束的时候保存一个cookie
  curlopt_cookiefile,cookie的文件。
  http服务器认证
  最后,我们来看一看http服务器认证的情况。
复制代码 代码如下:

<?php
$ch = curl_init();
curl_setopt($ch, curlopt_url, 'http://www.example.com');
curl_setopt($ch, curlopt_returntransfer, 1);
curl_setopt($ch, curlopt_httpauth, curlauth_basic);
curl_setopt(curlopt_userpwd, '[username]:[password]')
$data = curl_exec();
curl_close($ch);
?>


看一个利用curl抓取163邮箱地址列表代码

curl技术说白了就是模拟浏览器的动作实现页面抓取或表单提交,通过此技术可以实现许多有去的功能。
复制代码 代码如下:

<?php
error_reporting(0);
//邮箱用户名(不带@163.com后缀的)
$user = 'papatata_test';
//邮箱密码
$pass = '000000';
//目标邮箱
//$mail_addr = uenucom@163.com';
//登陆
$url = 'http://reg.163.com/logins.jsp教程?type=1&url=http://entry.mail.163.com/coremail/fcg/ntesdoor2?lightweight%3d1%26verifycookie%3d1%26language%3d-1%26style%3d-1';
$ch = curl_init($url);
//创建一个用于存放cookie信息的临时文件
$cookie = tempnam('.','~');
$referer_login = 'http://mail.163.com';
//返回结果存放在变量中,而不是默认的直接输出
curl_setopt($ch, curlopt_returntransfer, true);
curl_setopt($ch, curlopt_header, true);
curl_setopt($ch, curlopt_connecttimeout, 120);
curl_setopt($ch, curlopt_post, true);
curl_setopt($ch, curlopt_referer, $referer_login);
$fields_post = array(
'username'=> $user,
'password'=> $pass,
'verifycookie'=>1,
'style'=>-1,
'product'=> 'mail163',
'seltype'=>-1,
'secure'=>'on'
);
$headers_login = array(
'user-agent' => 'mozilla/5.0 (windows; u; windows nt 5.1; zh-cn; rv:1.9) gecko/2008052906 firefox/3.0',
'referer' => 'http://www.163.com'
);
$fields_string = '';
foreach($fields_post as $key => $value)
{
$fields_string .= $key . '=' . $value . '&';
}
$fields_string = rtrim($fields_string , '&');
curl_setopt($ch, curlopt_cookiesession, true);
//关闭连接时,将服务器端返回的cookie保存在以下文件中
curl_setopt($ch, curlopt_cookiejar, $cookie);
curl_setopt($ch, curlopt_httpheader, $headers_login);
curl_setopt($ch, curlopt_post, count($fields));
curl_setopt($ch, curlopt_postfields, $fields_string);
$result= curl_exec($ch);
curl_close($ch);
//跳转
$url='http://entry.mail.163.com/coremail/fcg/ntesdoor2?lightweight=1&verifycookie=1&language=-1&style=-1&username=loki_wuxi';
$ch = curl_init($url);
$headers = array(
'user-agent' => 'mozilla/5.0 (windows; u; windows nt 5.1; zh-cn; rv:1.9) gecko/2008052906 firefox/3.0'
);
curl_setopt($ch, curlopt_returntransfer, true);
curl_setopt($ch, curlopt_header, true);
curl_setopt($ch, curlopt_connecttimeout, 120);
curl_setopt($ch, curlopt_post, true);
curl_setopt($ch, curlopt_httpheader, $headers);
//将之前保存的cookie信息,一起发送到服务器端
curl_setopt($ch, curlopt_cookiefile, $cookie);
curl_setopt($ch, curlopt_cookiejar, $cookie);
$result = curl_exec($ch);
curl_close($ch);
//取得sid
preg_match('/sid=[^"].*/', $result, $location);
$sid = substr($location[0], 4, -1);
//file_put_contents('./result.txt', $sid);
//通讯录地址
$url='http://g4a30.mail.163.com/jy3/address/addrlist.jsp?sid='.$sid.'&gid=all';
$ch = curl_init($url);
$headers = array(
'user-agent' => 'mozilla/5.0 (windows; u; windows nt 5.1; zh-cn; rv:1.9) gecko/2008052906 firefox/3.0'
);
curl_setopt($ch, curlopt_returntransfer, true);
curl_setopt($ch, curlopt_header, true);
curl_setopt($ch, curlopt_connecttimeout, 120);
curl_setopt($ch, curlopt_post, true);
curl_setopt($ch, curlopt_httpheader, $headers);
curl_setopt($ch, curlopt_cookiefile, $cookie);
curl_setopt($ch, curlopt_cookiejar, $cookie);
$result = curl_exec($ch);
curl_close($ch);
//file_put_contents('./result.txt', $result);
unlink($cookie);
//开始抓取内容
preg_match_all('/<td class="ibx_td_addrname"><a[^>]*>(.*?)</a></td><td class="ibx_td_addremail"><a[^>]*>(.*?)</a></td>/i', $result,$infos,preg_set_order);
//1:姓名2:邮箱
print_r($infos);
?>

php教程读取flash文件高宽帧数背景颜色代码

<?php
/*
示例:
  $file = '/data/ad_files/5/5.swf';
  $flash = new flash();
  $flash = $flash->getswfinfo($file);
  echo "
文件的宽高是:".$flash["width"].":".$info["height"];
  echo "
文件版本是".$flash["version"];
  echo "
文件帧数量是".$flash["framecount"];
  echo "
文件帧速率是".$flash["framerate"];
  echo "
文件背景颜色是".$flash["bgcolor"];
*/
class flash
{
  //是否返回背景色
  public $need_back_color = false ;
 
  //是否返回版本
  public $need_version = false ;
 
  //是否返回帧速率
  public $need_framerate = false ;
 
  //是否返回帧数量
  public $need_framecount = false ;

  public function __construct()
  {

  }

  public function getswfinfo( $filename )
  {
    if ( file_exists($filename) ) {
       //echo "文件的修改时间:".date("m d y h:i:s.", filemtime($filename))."
";
    } else {
       //echo "目标文件不存在!";
       return array( "error" => $filename ) ;
    }

    //打开文件
    $rs = fopen($filename,"r");
   
    //读取文件的数据
    $str = fread( $rs , filesize( $filename ) ) ;
    ///
    if($str[0] == "f")
    {
       //echo "
文件已是解压缩的文件:";
    } else {
       $first = substr($str,0,8);
       $last = substr($str,8);
       //
       $last = gzuncompress($last);
       //
       $str = $first . $last ;
       $str[0] = "f";
       //echo "
解压缩后的文件信息:";
    }

    $info = $this->getinfo( $str );
    fclose ( $rs ) ;
    return $info;
  }

  private function mydecbin($str,$index)
  {
    $fbin = decbin(ord($str[$index]));
    while(strlen($fbin)<8)$fbin="0".$fbin;
    return $fbin;
  }

  private function colorhex($data)
  {
    $tmp = dechex($data);
    if ( strlen($tmp)<2 ) {
      $tmp='0' . $tmp ;
    }
    return $tmp;
  }

  private function getinfo( $str )
  {
    //换算成二进制
    $fbin = $this->mydecbin( $str , 8 ) ;
   
    //计算rec的单位长度
    $slen = bindec( substr( $fbin , 0 , 5 ) );
   
    //计算rec所在的字节
    $recsize = $slen * 4 + 5 ;
    $recsize = ceil( $recsize / 8 ) ;

    //rec的二进制
    $recbin = $fbin ;
    for( $i = 9 ; $i < $recsize + 8 ; $i++ )
    {
       $recbin .= $this->mydecbin( $str ,$i );
    }

    //rec数据
    $rec = array();
    for( $i = 0 ; $i < 4 ; $i++ )
    {
       $rec[] = bindec( substr( $recbin , 5 + $i * $slen , $slen ) ) / 20 ;
    }
   
    if ( $this->need_back_color ) {
      //背景颜色
      for( $i = $recsize + 12 ; $i < strlen ( $str ) ; $i ++ )
      {
         if ( ord( $str[$i] ) == 67 && ord( $str[$i+1] ) == 2 )
         {
          $bgcolor = $this->colorhex(ord($str[$i+2])).$this->colorhex(ord($str[$i+3])).$this->colorhex(ord($str[$i+4]));
          break;
         }
      }
    }
   
    if ( $this->need_version ) {
      //版本
      $version = ord( $str[3] );
    }
    if ( $this->need_framerate ) {
      //帧速率
      $framerate = ord( $str[$recsize + 8] ) / 256 + ord( $str[$recsize + 9] ) ;
    }

    if ( $this->need_framecount ) {   
      //帧数量
      $framecount = ord( $str[$recsize + 11] ) * 256 + ord( $str[$recsize + 10] );
    }
   
    return  array ( "bgcolor" => $bgcolor ,
            "version" => $version ,
            "framerate" => $framerate ,
            "framecount" => $framecount ,
            'width'=>$rec[1],
            'height'=>$rec[3]
            );
  }
}

?>

php教程 获取目录下所有文件实现代码
class a{   
 private $img_dir;
        private $img_path;
        private $face_files = array();
        private $allow_extension = array();

private function get_face_files()
        {
            $files = array();
            if(is_dir($this->img_dir))
            {
                if ($dh = opendir($this->img_dir))
                {
                    while (($file = readdir($dh)) !== false)
                    {
                        if($file == '.') continue;
                        if($file == '..') continue;
                        $fileinfo = explode('.', (basename($file)));
                        if(in_array($fileinfo[1], $this->allow_extension))
                        {
                            $files[] = array(
                                'filename' => $fileinfo[0],
                                'extension' => $fileinfo[1],
                            );
                        }
                    }
                    closedir($dh);
                }
            }
            return $files;
        }
}

[!--infotagslink--]

相关文章

  • php语言实现redis的客户端

    php语言实现redis的客户端与服务端有一些区别了因为前面介绍过服务端了这里我们来介绍客户端吧,希望文章对各位有帮助。 为了更好的了解redis协议,我们用php来实现...2016-11-25
  • jQuery+jRange实现滑动选取数值范围特效

    有时我们在页面上需要选择数值范围,如购物时选取价格区间,购买主机时自主选取CPU,内存大小配置等,使用直观的滑块条直接选取想要的数值大小即可,无需手动输入数值,操作简单又方便。HTML首先载入jQuery库文件以及jRange相关...2015-03-15
  • 不打开网页直接查看网站的源代码

      有一种方法,可以不打开网站而直接查看到这个网站的源代码..   这样可以有效地防止误入恶意网站...   在浏览器地址栏输入:   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实现的简洁纵向滑动菜单(滑动门)效果

    本文实例讲述了JS实现的简洁纵向滑动菜单(滑动门)效果。分享给大家供大家参考,具体如下:这是一款纵向布局的CSS+JavaScript滑动门代码,相当简洁的手法来实现,如果对颜色不满意,你可以试着自己修改CSS代码,这个滑动门将每一...2015-10-21
  • 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
  • JS实现双击屏幕滚动效果代码

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

    其实挺简单的就是if(navigator.userAgent.indexOf('UCBrowser') > -1) {alert("uc浏览器");}else{//不是uc浏览器执行的操作}如果想测试某个浏览器的特征可以通过如下方法获取JS获取浏览器信息 浏览器代码名称:navigator...2015-11-08
  • jQuery+slidereveal实现的面板滑动侧边展出效果

    我们借助一款jQuery插件:slidereveal.js,可以使用它控制面板左右侧滑出与隐藏等效果,项目地址:https://github.com/nnattawat/slideReveal。如何使用首先在页面中加载jquery库文件和slidereveal.js插件。复制代码 代码如...2015-03-15
  • 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+jQuery翻板抽奖功能实现

    翻板抽奖的实现流程:前端页面提供6个方块,用数字1-6依次表示6个不同的方块,当抽奖者点击6个方块中的某一块时,方块翻转到背面,显示抽奖中奖信息。看似简单的一个操作过程,却包含着WEB技术的很多知识面,所以本文的读者应该熟...2015-10-21
  • PHP开发微信支付的代码分享

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

    sqlmap 是一个自动SQL 射入工具。它是可胜任执行一个广泛的数据库管理系统后端指印, 检索遥远的DBMS 数据库等,下面我们来看一个学习例子。 自己搭建一个PHP+MYSQ...2016-11-25
  • 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