由php中字符offset特征造成的繞過漏洞詳解
738
2023-12-08
(PHP 4, PHP 5)
count_chars — 返回字符串所用字符的信息
$string
[, int $mode
= 0
] )
統計 string
中每個字節值(0..255)出現的次數,使用多種模式返回結果。
string
需要統計的字符串。
mode
參見返回的值。
根據不同的 mode
,count_chars()
返回下列不同的結果:
0 - 以所有的每個字節值作為鍵名,出現次數作為值的數組。
1 - 與 0 相同,但只列出出現次數大于零的字節值。
2 - 與 0 相同,但只列出出現次數等于零的字節值。
3 - 返回由所有使用了的字節值組成的字符串。
4 - 返回由所有未使用的字節值組成的字符串。
Example #1 count_chars() 示例
<?php
$data = "Two Ts and one F.";
foreach (count_chars($data, 1) as $i => $val) {
echo "There were $val instance(s) of "" , chr($i) , "" in the string.n";
}
?>
以上例程會輸出:
There were 4 instance(s) of " " in the string. There were 1 instance(s) of "." in the string. There were 1 instance(s) of "F" in the string. There were 2 instance(s) of "T" in the string. There were 1 instance(s) of "a" in the string. There were 1 instance(s) of "d" in the string. There were 1 instance(s) of "e" in the string. There were 2 instance(s) of "n" in the string. There were 2 instance(s) of "o" in the string. There were 1 instance(s) of "s" in the string. There were 1 instance(s) of "w" in the string.
strpos() - 查找字符串首次出現的位置 substr_count() - 計算字串出現的次數
#免責聲明#
本站[綠夏技術導航]提供的一切軟件、教程和內容信息僅限用于學習和研究目的;不得將上述內容用于商業或者非法用途,否則,一切后果請用戶自負。本站信息來自網絡收集整理,版權爭議與本站無關。您必須在下載后的24個小時之內,從您的電腦或手機中徹底刪除上述內容。如果您喜歡該程序或內容,請支持正版,購買注冊,得到更好的正版服務。我們非常重視版權問題,如有侵權請郵件[admin@lxwl520.com]與我們聯系進行刪除處理。敬請諒解!