var formData = new FormData($( "#addForm" )[0]);//addForm是表单的id,不是input file的
                            $.ajax({
                            url: 'admin/Lunbo/insert',
                            data: formData,
                            type: 'POST',
                            async: false,//1,这四个要写上,否则点击没反应
                            cache: false,//2
                            contentType: false,//3
                            processData: false,//4
                            dataType: 'JSON',
                            success: function (returnData) {
                                alert(200);
                            },
                            error: function () {
                                alert(0);
                            },

background-attachment:fixed;在pc端有效,移动端无效,解决如下:
body:before {
      content: ' ';
      position: fixed;
      z-index: -1;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      background: url(...) center 0 no-repeat;
      background-size: cover;
    }

pushHistory();
    window.addEventListener("popstate", function(e) {
        window.location = "{php echo $this->createMobileUrl('goindex',array())}";
    }, false);
    function pushHistory() {
        var state = {
            title: "title",
            url: "#"
        };
        window.history.pushState(state, "title", "#");
    }
    XBack.listen(function(){
        alert('back');
    });

图像压缩:
参数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){

}