mwwdfl 发布的文章

1、jQuery判断checked是否是选中状态的三种方法:
.attr('checked') // 返回:"checked"或"undefined" ;
.prop('checked') // 返回true/false(推荐!!!!!!!!!)
.is(':checked')  // 返回true/false //别忘记冒号哦
2、jQuery赋值checked的几种写法:(不建议用attr)
$("#cb1").prop("checked",true); //标准写法,推荐!
$("#cb1").prop({checked:true}); //map键值对    
$("#cb1").prop("checked",function(){
    return true;//函数返回true或false
});

1、引入:

jquery和js
<script src="path/to/jquery.min.js"></script>
<script src="path/to/circleChart.min.js"></script> 

2、使用一个div元素作为该圆形百分比进度条的HTML结构

<div class="circleChart" id="circle1"></div>

3、初始化插件

$(".circleChart").circleChart({
            size: 300,
            value: 50,
            text: 0,
            onDraw: function(el, circle) {
                circle.text(Math.round(circle.value) + "%"); // 根据value修改text
            }
        });
参数:
color: "#3459eb", // 进度条颜色
backgroundColor: "#e6e6e6", // 进度条之外颜色
background: true, // 是否显示进度条之外颜色
speed: 2000, // 出现的时间
widthRatio: 0.2, // 进度条宽度
value: 66,  // 进度条占比
unit: "percent",
counterclockwise: false, // 进度条反方向
size: 110, // 圆形大小
startAngle: 0, // 进度条起点
animate: true, // 进度条动画
backgroundFix: true,
lineCap: "round",
animation: "easeInOutCubic",
text: false, // 进度条内容
redraw: false,
cAngle: 0,
textCenter: true,
textSize: false,
textWeight: "normal",
textFamily: "sans-serif",
relativeTextSize: 1 / 7, // 进度条中字体占比
autoCss: true,
onDraw: false

//问题描述:安卓下无此问题,在ios自带的浏览器中,H5页面在input输入获取焦点后键盘弹出,随便触碰一个地方要使键盘隐藏
//解决方案:如下
jQuery("body").on("touchend", function() { //body上面绑定touchend事件
jQuery(".input_box").each(function (i, v) { //自定义一个.input_box classname ,多个时绑定多个,遍历
if(jQuery(this).is(":focus") === true){ //如果当前input框获取到了焦点
jQuery(this).blur(); // 使其失去即可
}
});
})
比较传统的解决办法,遇到相同问题的童鞋可以试试。

二维数组,都有一个年龄的值,按照年龄倒序排序
也可以是两个不同的二维数组,但只要age字段保持一致就可以排序

header('Content-Type:text/html;Charset=utf-8');
$arrUsers = array(
    array(
            'id'   => 1,
            'name' => '张三',
            'age'  => 25,
    ),
    array(
            'id'   => 2,
            'name' => '李四',
            'age'  => 23,
    ),
    array(
            'id'   => 3,
            'name' => '王五',
            'age'  => 40,
    ),
    array(
            'id'   => 4,
            'name' => '赵六',
            'age'  => 31,
    ),
    array(
            'id'   => 5,
            'name' => '黄七',
            'age'  => 20,
    ),
); 
 
 
$sort = array(
        'direction' => 'SORT_DESC', //排序顺序标志 SORT_DESC 降序;SORT_ASC 升序
        'field'     => 'age',       //排序字段
);
$arrSort = array();
foreach($arrUsers AS $uniqid => $row){
    foreach($row AS $key=>$value){
        $arrSort[$key][$uniqid] = $value;
    }
}
if($sort['direction']){
    array_multisort($arrSort[$sort['field']], constant($sort['direction']), $arrUsers);
}
 
var_dump($arrUsers);

纯示例:

function get(){

        $url ="http://119.29.166.254:9090/api/university/getUniversityByProvinceId?id=1";

        $ch = curl_init();
        //设置选项,包括URL
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);

        //执行并获取HTML文档内容
        $output = curl_exec($ch);
        //释放curl句柄
        curl_close($ch);
        $res = json_decode($output,true);
        return $res;
        var_dump($res);
    }