图像压缩:
参数1、原图片地址(完整的图片路径)
参数2、压缩后的图片地址,也是完整的

function image_png_size_add($imgsrc,$imgdst){
        list($width,$height,$type)=getimagesize($imgsrc);
        $new_width = ($width>600?600:$width)*0.9;
        $new_height =($height>600?600:$height)*0.9;
        switch($type){
            case 1:
                break;
            case 2:
                header('Content-Type:image/jpeg');
                $image_wp=imagecreatetruecolor($new_width, $new_height);
                $image = imagecreatefromjpeg($imgsrc);
                imagecopyresampled($image_wp, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
                imagejpeg($image_wp, $imgdst,75);
                imagedestroy($image_wp);
                echo 232;
                break;
            case 3:
                header('Content-Type:image/png');
                $image_wp=imagecreatetruecolor($new_width, $new_height);
                $image = imagecreatefrompng($imgsrc);
                imagecopyresampled($image_wp, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
                imagejpeg($image_wp, $imgdst,75);
                imagedestroy($image_wp);
                break;
        }
    }

jQuery
var json = "{...}";
var obj = JSON.parse(json);
    $.each(obj,function(index,data){
        alert(data);
    });
PHP
$json = "{...}";
$obj = json_decode($json);
$array = (array)$obj;
foreach ($b as $k=>$v){

}

var idCard = $('#card').val();
        if(idCard != "") {
            //15位和18位身份证号码的正则表达式
            var regIdCard = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/;

            //如果通过该验证,说明身份证格式正确,但准确性还需计算
            if (regIdCard.test(idCard)) {
                if (idCard.length == 18) {
                    var idCardWi = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); //将前17位加权因子保存在数组里
                    var idCardY = new Array(1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2); //这是除以11后,可能产生的11位余数、验证码,也保存成数组
                    var idCardWiSum = 0; //用来保存前17位各自乖以加权因子后的总和
                    for (var i = 0; i < 17; i++) {
                        idCardWiSum += idCard.substring(i, i + 1) * idCardWi[i];
                    }

                    var idCardMod = idCardWiSum % 11;//计算出校验码所在数组的位置
                    var idCardLast = idCard.substring(17);//得到最后一位身份证号码

                    //如果等于2,则说明校验码是10,身份证号码最后一位应该是X
                    if (idCardMod == 2) {
                        if (idCardLast == "X" || idCardLast == "x") {
                            // alert("恭喜通过验证啦!");
                        } else {
                            alert('身份证号码错误');
                            return false;
                        }
                    } else {
                        //用计算出的验证码与最后一位身份证号码匹配,如果一致,说明通过,否则是无效的身份证号码
                        if (idCardLast == idCardY[idCardMod]) {
                            //alert("恭喜通过验证啦!");
                        } else {
                            alert('身份证号码错误');
                            return false;
                        }
                    }
                }
            } else {
                alert('身份证格式不正确');
                return false;
            }
        }else{
            alert('身份证号码不能为空');
            return false;
        }

swiper-3.4.2.min.css
swiper-3.4.2.min.js(如果引入了jQuery可以用简化的swiper)
定义容器:

        <div class="swiper-button-prev"></div>//上一页也可以放在这,把position改成static就可以自定义样式了
    <div class="swiper-container">
      <div class="swiper-wrapper">
        <div class="swiper-slide">11111111111</div>
        <div class="swiper-slide">22222222222</div>
        <div class="swiper-slide">33333333333</div>
      </div>    
            <div class="swiper-button-prev"></div>  
            <div class="swiper-button-next"></div>
    </div>
    <div class="swiper-button-next"></div>//同上一页(默认的有margin-top:-20px)

js代码:

window.onload = function(){
        var mySwiper = new Swiper('.swiper-container',{
        slidesPerView : 4,//显示几条
        prevButton:'.swiper-button-prev',//上一页
        nextButton:'.swiper-button-next',//下一页
                spaceBetween:10//slide之间的间距,px
        //centeredSlides : true,//第一张是不是放到中间
        })
    }

ps:
和angularjs结合来使用的时候,通过ng-repeat创建出来的swiper-slide,会出现无法滑动,布局变形等情况,这时候,设置

observer:true; //修改Swiper自己或子元素时初始化Swiper

observeParents:true; //修改Swiper的父元素时,自动初始化Swiper