月度归档:2017年02月

cacti,当udp不能用时,使用tcp的snmp监控服务器

国内网络环境复杂,udp往往不能用,可代用tcp,注意如下

添加设备的地方:
hostname tcp:ip 不是写ip,这里写tcp:192.168.0.xxx

snmp协议,通过修改/etc/sysconfig/snmpd文件,加入监听tcp端口
如:
# snmpd command line options
OPTIONS="tcp:1161 -LS0-6d -Lf /dev/null -p /var/run/snmpd.pid"

就可以了

thinkphp5中的pathinfo解析,nginx说明

nginx用正则拆分uri,官方的说明,很清楚!!!
thinkphp5必备!!!

Syntax: fastcgi_split_path_info regex;
Default: —
Context: location
Defines a regular expression that captures a value for the $fastcgi_path_info variable. The regular expression should have two captures: the first becomes a value of the $fastcgi_script_name variable, the second becomes a value of the $fastcgi_path_info variable. For example, with these settings

location ~ ^(.+\.php)(.*)$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME /path/to/php$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;

and the “/show.php/article/0001” request, the SCRIPT_FILENAME parameter will be equal to “/path/to/php/show.php”, and the PATH_INFO parameter will be equal to “/article/0001”.

模板文件中用的多,如page.tpl.php

流程控制的替代语法

(PHP 4, PHP 5, PHP 7)

PHP 提供了一些流程控制的替代语法,包括 ifwhileforforeachswitch。替代语法的基本形式是把左花括号({)换成冒号(:),把右花括号(})分别换成 endif;endwhile;endfor;endforeach; 以及 endswitch;

<?php if ($a == 5): ?>
A is equal to 5
<?php endif; ?>

在上面的例子中,HTML 内容“A is equal to 5”用替代语法嵌套在 if 语句中。该 HTML 的内容仅在 $a 等于 5 时显示。