分类 默认分类 下的文章

function randIp() {
    $arr_1 = ["218", "218", "66", "66", "218", "218", "60", "60", "202", "204", "66", "66", "66", "59", "61", "60", "222", "221", "66", "59", "60", "60", "66", "218", "218", "62", "63", "64", "66", "66", "122", "211"];
    $randarr= mt_rand(0,count($arr_1)-1);
    $ip1id = $arr_1[$randarr];
    $ip2id=  round(rand(600000,  2550000)  /  10000);
    $ip3id=  round(rand(600000,  2550000)  /  10000);
    $ip4id=  round(rand(600000,  2550000)  /  10000);
    return  $ip1id . "." . $ip2id . "." . $ip3id . "." . $ip4id;
}

分享网址:
http://www.dooccn.com/php7/#id/b68e0f6af9ba47807a24478ffdaf2684

<?php
function randNumberArray($min, $max, $count){
    $res = [];
    foreach (range(1, $count) as $n) {
        $res[] = mt_rand($min, $max);
    }
    sort($res, SORT_NUMERIC);
    return $res;
}

/**
 * 合并秒和毫钞,并按从小到大排序
 */
function mergeTimeMillisecond($times, $milliseconds){
    sort($times, SORT_NUMERIC);
    $times = array_map(function ($v,$idx) use ($milliseconds) {
        return $v * 1000 + ($milliseconds[$idx]??0);
    }, $times, array_keys($times));
    sort($times, SORT_NUMERIC);
    $times = array_map(function ($v) {
        $_f = explode('.', strval($v / 1000));
        return [
            $_f[0],
            $_f[1]??0
        ];
    }, $times, array_keys($times));
    return $times;
}

function randMillisecond($count, $total, $extent=0.3){
    $res = [];
    $svg = $total / $count;
    for($i=1;$i<$count;$i++){
        $_rand = mt_rand(max(0, $svg-($svg*$extent)), min(999, $svg+($svg*$extent)));
        $res[] = $_rand;
    }
    $end = $total - array_sum($res);
    if ($end < 0) {
        $end = abs($end);
        foreach ($res as &$v) {
            if ($v > $end) {
                $v -=$end;
                continue;
            }
        }
        unset($v);
        $end = 0;
    }
    $res[] = $end;
    shuffle($res);
    return $res;
}

$count = 10;
$total = intval(999 * $count * .5);
$res = randMillisecond($count, $total);
$times =  randNumberArray(time() - 10, time(), 10);
$times = mergeTimeMillisecond($times, $res);
var_dump($count, $total, $res, array_sum($res), $times);

查看命令文档:

man ls

按大小排序:

ll -Sh

按时间排序:

ll -t

默认是按降序,如要按升序可+上管道:| tac

可能的情况:
1、服务器磁盘满了,查看磁盘
https://blog.csdn.net/dujianxiong/article/details/84288658

df -h

2、nginx的fastcgi_temp目录没有读写权限,查看nginx的error日志,会发现:

2010/03/13 02:52:19 [crit] 3396#0: *10 open() 
"/usr/local/nginx/fastcgi_temp/2/00/0000000002" failed (13: Permission denied)

处理方法,给目录增加权限或者修改所有者为nginx worker的运行用户

chown www:www /usr/local/nginx/fastcgi_temp -R

分析 fastcgi_temp 错误以及 Nginx 的 Buffer 机制: https://blog.csdn.net/crx05/article/details/70210323