1、开放端口
firewall-cmd –zone=public –add-port=12345/tcp –permanent # 开放12345端口
firewall-cmd –zone=public –remove-port=12345/tcp –permanent #关闭12345端口
firewall-cmd –reload # 配置立即生效

2、查看防火墙所有开放的端口
firewall-cmd –zone=public –list-ports

3、关闭防火墙
systemctl stop firewalld.service

4、查看防火墙状态
firewall-cmd –state

5、查看监听的端口
yum install -y net-tools
netstat -lnpt

6、检查端口被哪个进程占用
netstat -lnpt |grep 12345

function rateConfig()
{
return [
1 => 0.397,
2 => 0.400,
3 => 0.203,
];
}

function randRate()
{
$rateConfig = rateConfig();
foreach ($rateConfig as $k => $v) {
$rateConfig[$k] = $v * 10000;
}

//概率数组的总概率精度
$proSum = array_sum($rateConfig);

//概率数组循环
foreach ($rateConfig as $key => $proCur) {
$randNum = mt_rand(1, $proSum);
if ($randNum <= $proCur) {
$result = $key;
break;
} else {
$proSum -= $proCur;
}
}
unset ($proArr);
return $result;
}

server
{
listen 80;
server_name xx.com;
index index.html index.php;
root /www/xx.com;

location /
{
index index.php;
if (!-e $request_filename) {
#多入口这几行也不需要
#rewrite /admin.php(.*)$ /admin.php$1 last;
#rewrite ^(.*)$ /index.php/$1;
#break;
rewrite ^/(.*)$ /index.php?s=$1 last;
}
}
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
#try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi5.6.sock;
fastcgi_index index.php;
include fastcgi.conf;
#注意pathinfo.conf不需要
#include pathinfo.conf;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}

location ~ .*\.(js|css)?$
{
expires 12h;
}

access_log off;
}

稀疏函数实现

package array;

public class sparseArray {
public static void main(String[] args) {
sparse();
}

public static void sparse() {
int length = 11;
int[][] array1 = new int[length][length];
array1[2][3] = 1;
array1[3][4] = 2;
System.out.println("原始数组");
prints(array1);

System.out.println("转为稀疏数组");
int sum = 0;//系数数组的个数
for (int i = 0; i < array1.length; i++) { for (int j = 0; j < array1.length; j++) { if (array1[i][j] != 0) { sum += 1; } } } int[][] array2 = new int[sum + 1][3]; array2[0][0] = length; array2[0][1] = length; array2[0][2] = sum; //赋值稀疏数组 int count = 0; for (int i = 0; i < array1.length; i++) { for (int j = 0; j < array1[i].length; j++) { if (array1[i][j] != 0) { count++; array2[count][0] = i; array2[count][1] = j; array2[count][2] = array1[i][j]; } } } prints(array2); System.out.println("还原稀疏数组"); int[][] array3 = new int[length][length]; for (int i = 1; i < array2.length; i++) { array3[array2[i][0]][array2[i][1]] = array2[i][2]; } prints(array3); } public static void prints(int[][] array) { for (int[] ints : array) { for (int anInt : ints) { System.out.print(anInt + "\t"); } System.out.println(); } } }