COUNT中使用去重

Db::name('table_name')->count('DISTINCT field_name');

模型使用With联查时删选附表的数据

self::with(['paylist' => function($query) use($type) {
                $query->where('type', $type);
            }])

Windows 宝塔 nginx thinkphp5 404

某种未知情况导致nginx+thinkphp5出现404的现象,经过多方查阅得到解决方案:(注释掉的是默认的)

location ~ \.php(.*)$ { 
    try_files $uri =404; 
    fastcgi_pass 127.0.0.1:20073; 
    fastcgi_index index.php; 
    # fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; 
    # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    # fastcgi_param PATH_INFO $fastcgi_path_info; 
    # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 

    set $real_script_name $fastcgi_script_name; 
    if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { 
        set $real_script_name $1; 
        set $path_info $2; 
    } 
    fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; 
    fastcgi_param SCRIPT_NAME $real_script_name; 
    fastcgi_param PATH_INFO $path_info; 
    include fastcgi_params; 
}