PHP生成随机中文字符串
<?php function unicode_decode($name) { // 转换编码,将Unicode编码转换成可以浏览的utf-8编码 $pattern = '/([\w]+)|(\\\u([\w]{4}))/i'; preg_match_all($pattern, $name, $matches); if (!empty($matches)) { $name = ''; for ($j = 0; $j < count($matches[0]); $j++) { $str = $matches[0][$j]; if (strpos($str, '\\u') === 0) { $code = base_convert(substr($str, 2, 2), 16, 10); $code2 = base_convert(substr($str, 4), 16, 10); $c = chr($code) . chr($code2); $c = iconv('UCS-2', 'UTF-8', $c); $name.= $c; } else { $name.= $str; } } } return $name; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { } else { $str = ""; for ($i = 0; $i < 100; $i++) { $str.= "\\u" . dechex(rand(19968, 40895)); } $content.= unicode_decode($str); } ?> <!DOCTYPE> <html> <head> <title>blog</title> </head> <body> <span><?php echo $_COOKIE["uid"] ?></span> <form action="<?php htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="post" accept-charset="utf-8"> <input type="text" name="title"> <br> <textarea name="content" id="" cols="30" rows="10"><?php echo $content; ?></textarea> <br> <input type="submit" name='submit'> </form> </body> </html>
登入後複製
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

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

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

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

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

熱門文章
如何修復KB5055612無法在Windows 10中安裝?
4 週前
By DDD
<🎜>:泡泡膠模擬器無窮大 - 如何獲取和使用皇家鑰匙
4 週前
By 尊渡假赌尊渡假赌尊渡假赌
<🎜>:種植花園 - 完整的突變指南
3 週前
By DDD
北端:融合系統,解釋
4 週前
By 尊渡假赌尊渡假赌尊渡假赌
Mandragora:巫婆樹的耳語 - 如何解鎖抓鉤
3 週前
By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

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

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)