Hongmu Notes
Home Language Notes Here's a very practical article featuring pseudo-original PHP code.
Language Notes PHP

Here's a very practical article featuring pseudo-original PHP code.

Here's a very practical article featuring pseudo-original PHP code.

This code can randomly insert ASCII characters into an article; the frontend can then hide these ASCII characters. This approach ensures that the user experience remains unaffected while simultaneously misleading Baidu's web crawler, thereby achieving a pseudo-original content effect.

I downloaded this from several novel websites – it's really handy!

PHP code:

function randAscii($string){
    if(empty($string)){
        return false;
    }
    
    //【随机插入字符串】
    preg_match_all("/./u", $string, $arr);
    $arrNew = array(1,10);
    $str = '';
    $inHtmlTag = false;
    foreach ($arr[0] as $k=>$v){
        if ($v == '<') {
            $inHtmlTag = true;
        } else if ($v == '>') {
            $inHtmlTag = false;
        }
        if ($inHtmlTag) {
            $str.= $v;
        } else {
            if($k == 0){
                $str.= $v.'';
            }else{
                $key = array_rand($arrNew,1);
                $rand = $arrNew[$key];
                $shuzi = mt_rand(800, 810);
                $str.= ($rand % 10) == 0 ? $v."<i>&#xe".$shuzi.";</i>": $v;
            }
        }
    }
    return $str;
}

CSScode

i {
    display:none;
}

 

微信赞赏

WeChat

支付宝赞赏

Alipay

✍️ Author: Hong Mu

webmaster · Thanks for reading, stay tuned for more exciting content

Author homepage View home page →

Related articles

PHP ob function record

PHP ob function record Language Notes PHP

Usage of the following three functions ob_get_contents(); ob_end_clean(); ob_start(); You can use these functions to buffer local files and execute local script code. Use ob_start() to save the output code into the buffer, and the page will not be displayed; then use ob_get_contents to get the data in the buffer. o…
👁 141
PHP preg

PHP preg Language Notes PHP

The preg_match_all function is used to perform a global regular expression match. preg_match_all() Syntax int preg_match_all ( string $pattern , string $subject [, array &$matches [, int $flags = PREG…
👁 169
Detailed explanation of PHP ternary operator and if

Detailed explanation of PHP ternary operator and if Language Notes PHP

Ternary operator condition ? Result 1 : Result 2 Explanation: The position in front of the question mark is the condition for judgment. If the condition is met, the result is 1, and if it is not met, the result is 2. This article compares and explains the ternary operator and if...else... in detail. I hope it will be helpful to everyone. Today when I was revising my paper online, I encountered a statement that I couldn’t understand: $if_summary = $row['IF_SUMMARY']=…
👁 189
PHP cast type

PHP cast type Language Notes PHP PHP collection PHP and mysql

Get the data type 1. If you want to check the value and type of an expression, use var_dump(). 2. If you just want to get an easy-to-read type expression for debugging, use gettype(). 3. To check a certain type, do not use gettype(), but use the is_type() function. Converting Strings to Numbers When a string is evaluated as a number, the result is determined according to the following rules...
👁 232

Recommended reading

(PC + WAP) Hardware and Machinery Marketing Website Template – 1019

(PC + WAP) Hardware and Machinery Marketing Website Template – 1019 Practical Collection pbootcms Template

A marketing-oriented PbootCMS website template for hardware and machinery equipment businesses, compatible with both PC and WAP devices. Featuring a professional marketing design style, this template is ideal for hardware and machinery enterprises to showcase their products and technological capabilities. It helps machinery manufacturing companies present their products online and attract targeted customer inquiries. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn...
👁 44
(Adaptive mobile version) Responsive decorative engineering website PBootCMS template – Download HTML5 decorative and renovation company website source code – 0316

(Adaptive mobile version) Responsive decorative engineering website PBootCMS template – Download HTML5 decorative and renovation company website source code – 0316 Practical Collection pbootcms Template

This set of responsive decorative engineering and interior design company PbootCMS website templates is built using HTML5 technology. The modern and professional design style is ideal for showcasing decorative project examples, construction expertise, and design concepts. It helps renovation companies attract homeowners online and secure new projects. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5...
👁 48
treatment rules

treatment rules Hobbies Memo notes

Treatment of five acupoints Jing --- fullness under the heart Rong --- body heat Yu --- weight and joint pain Meridian --- asthma, cough, cold and heat Combined --- diarrhea due to adverse qi Main and guest treatment (original collateral therapy) Main --- diseased meridian --- original guest --- surface or inner meridian --- collateral --- Yin meridian (take Shu point) Large intestine meridian --- lung meridian Shu meridian treatment Indicating internal medicine diseases Acupuncture is used for heat syndrome, moxibustion is used for cold syndrome, and the patient has visceral pain, the Qie point is used to relieve pain, and the eight major points are used to relieve pain first...
👁 180
Website Development – Mini-Program Development & Website Templates – 0567

Website Development – Mini-Program Development & Website Templates – 0567 Practical Collection Yiyou template

This EyouCMS professional template is ideal for the website development and mini-program development industries. Its modern, tech-driven design is perfect for showcasing website creation projects, mini-program development services, technical support, and customer testimonials. It helps internet technology companies effectively present their brand online and attract potential customers. Template Overview | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS...
👁 52
(Adaptive Mobile Version) Responsive Hardware Foreign Trade English Website Template – 1020

(Adaptive Mobile Version) Responsive Hardware Foreign Trade English Website Template – 1020 Practical Collection pbootcms Template

A responsive五金 industry外贸 English PbootCMS website template supporting both PC and WAP devices. Its international and professional design style is ideal for hardware manufacturing enterprises to showcase their products and export advantages. It helps Chinese hardware companies present their brand image in the global market. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn | Related Articles: P...
👁 54
(Adaptive mobile version) Responsive supermarket shelf display website PBootCMS template; Warehouse shelf website source code download – 0317

(Adaptive mobile version) Responsive supermarket shelf display website PBootCMS template; Warehouse shelf website source code download – 0317 Practical Collection pbootcms Template

An adaptive, responsive website template for mobile devices, designed for supermarket and warehouse shelving systems – compatible with PbootCMS. The design features a practical and professional style, ideal for showcasing shelving products, warehouse solutions, and project cases. It enables shelving manufacturers to display their products online and attract both retail and warehousing clients. Template Overview | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn...
👁 44