在所有php認為是int的地方輸入string,都會被強制轉換,例如
<code><span>$a</span> = <span>'asdfgh'</span>;<span>//字符串类型的a</br></span><span>echo</span><span>$a</span>[<span>2</span>]; <span>//根据php的offset 会输出'd'</br></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教學有興趣的朋友有幫助。