// 定义每排最多坐4人
$maxLine = 4;
// 确定学生编号为17
$no = 17;
// ceil()的作用是向上取整,以这里为例,17除以4等于4.25,所以向上取整就是5。17号的学生要坐在第五排。
$line = ceil($no/$maxLine);
// 重点在下面这句三元运算符(D = A ? B : C),如果A≠0,D=A;如果A=0,D=C。以这里为例,17÷4=4余1(17%4=1),即A=1,所以D=1。
$row = $no%$maxLine?$no%$maxLine:$maxLine;
$maxLine = 4;
// 确定学生编号为17
$no = 17;
// ceil()的作用是向上取整,以这里为例,17除以4等于4.25,所以向上取整就是5。17号的学生要坐在第五排。
$line = ceil($no/$maxLine);
// 重点在下面这句三元运算符(D = A ? B : C),如果A≠0,D=A;如果A=0,D=C。以这里为例,17÷4=4余1(17%4=1),即A=1,所以D=1。
$row = $no%$maxLine?$no%$maxLine:$maxLine;
2018-03-30
不加@
PHP Warning: mysql_connect(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in index.php on line 2 。。。。。
出错了,错误原因是:
加@
PHP Notice: Undefined variable: php_errormsg in index.php on line 3
出错了,错误原因是:
PHP Warning: mysql_connect(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in index.php on line 2 。。。。。
出错了,错误原因是:
加@
PHP Notice: Undefined variable: php_errormsg in index.php on line 3
出错了,错误原因是:
2018-03-30
就像$c+=6;和$c=$c+6;效果一样,字符串连接运算符用法与其相同,$c .="你好";和$c=$c."你好";效果
和C语言的OP=形式一样:
a+=c;
a=a+c;
以上两行代码是一个意思。
和C语言的OP=形式一样:
a+=c;
a=a+c;
以上两行代码是一个意思。
2018-03-30