mark php安全问题

来源:互联网 发布:怎么用js判断两个日期 编辑:程序博客网 时间:2024/05/17 01:10

在所有php认为是int的地方输入string,都会被强制转换,比如

$a = 'asdfgh'//字符串类型的a</br>echo $a[2];  //根据php的offset 会输出'd'</br>echo $a[x];  //根据php的预测,这里应该是int型,那么输入string,就会被intval成为0 也就是输出'a'

如果switch是数字类型的case的判断时,switch会将其中的参数转换为int类型。如下:

$i ="2abc";switch ($i) {case 0:case 1:case 2:    echo "i is less than 3 but not negative";    break;case 3:    echo "i is 3";}

松散比较的表格

这里写图片描述

0 0
原创粉丝点击