Heim >Backend-Entwicklung >PHP-Tutorial >mark php安全问题
在所有php认为是int的地方输入string,都会被强制转换,比如
<code><span>$a</span> = <span>'asdfgh'</span>;<span>//字符串类型的a</span><span>echo</span><span>$a</span>[<span>2</span>]; <span>//根据php的offset 会输出'd'</span><span>echo</span><span>$a</span>[x]; <span>//根据php的预测,这里应该是int型,那么输入string,就会被intval成为0 也就是输出'a'</span></code>
如果switch是数字类型的case的判断时,switch会将其中的参数转换为int类型。如下:
<code><span>$i</span> =<span>"2abc"</span>; <span>switch</span> (<span>$i</span>) { <span>case</span><span>0</span>: <span>case</span><span>1</span>: <span>case</span><span>2</span>: <span>echo</span><span>"i is less than 3 but not negative"</span>; <span>break</span>; <span>case</span><span>3</span>: <span>echo</span><span>"i is 3"</span>; }</code>
松散比较的表格
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });以上就介绍了 mark php安全问题,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。