php addslashes函数最终对应的c函数为:
3244 PHPAPI char *php_addslashes_ex(char *str, int length, int *new_length, int should_free, int ignore_sybase TS RMLS_DC)
3245 {
3246 /* maximum string length, worst case situation */
3247 char *new_str;
3248 char *source, *target;
3249 char *end;
3250 int local_new_length;
3251
3252 if (!new_length) {
3253 new_length = &local_new_length;
3254 }
3255 if (!str) {
3256 *new_length = 0;
3257 return str;
3258 }
3259 new_str = (char *) safe_emalloc(2, (length ? length : (length = strlen(str))), 1);
3260 source = str;
3261 end = source + length;
3262 target = new_str;
3263
3264 if (!ignore_sybase && PG(magic_quotes_sybase)) {
3265 while (source
3266 switch (*source) {
3267 case '\0':
3268 *target++ = '\\';
3269 *target++ = '0';
3270 break;
3271 case '\'':
3272 *target++ = '\'';
3273 *target++ = '\'';
3274 break;
3275 default:
3276 *target++ = *source;
3277 break;
3278 }
3279 source++;
3280 }
3281 } else {
3282 while (source
3283 switch (*source) {
3284 case '\0':
3285 *target++ = '\\';
3286 *target++ = '0';
3287 break;
3288 case '\'':
3289 case '\"':
3290 case '\\':
3291 *target++ = '\\';
3292 /* break is missing *intentionally* */
3293 default:
3294 *target++ = *source;
3295 break;
3296 }
3297
3298 source++;
3299 }
3300 }
3301
3302 *target = 0;
3303 *new_length = target - new_str;
3304 if (should_free) {
3305 STR_FREE(str);
3306 }
3307 new_str = (char *) erealloc(new_str, *new_length + 1);
3308 return new_str;
3309 }
从上面看addslashes函数处理的是单字节的字节。
但是gbk编码是双字节的。而且5c又可以做双字节的低位。

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

EditPlus 中文破解版
體積小,語法高亮,不支援程式碼提示功能

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

Safe Exam Browser
Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。

禪工作室 13.0.1
強大的PHP整合開發環境