How to give a random value to a class tag?
赵泽鑫
赵泽鑫 2022-01-13 11:12:29
0
9
1122

PHP language program, in a web page article, gives random values ​​(and unique, non-repeating) to all <span class="*">test text</span> tags at the "*", no matter how many characters there are Any letters or numbers will do. For example: <span class="Hug5iR2NvjO9">Test text</span>

赵泽鑫
赵泽鑫

reply all(3)
逆旅行人

It mainly depends on how you use it. "*" can be used as a parameter, and php will generate a random number and then replace it

  • reply But if you change the value of class, is there really no problem with your page style?
    autoload author 2022-01-13 17:08:41
  • reply This is applied within the article, such as every sentence and every paragraph, mainly to prevent crawler collection.
    赵泽鑫 author 2022-01-13 17:23:19
  • reply I wonder if you can explain it in detail. Thank you very much.
    赵泽鑫 author 2022-01-13 18:58:48
  • reply What should I say? Because I don't know how to replace this "*" specifically, it seems a little troublesome to implement in PHP. JS is easy to operate. You can directly select all spans and use traversal and classList.add (parameter). You can randomly generate this parameter.
    autoload author 2022-01-14 09:20:54
  • reply Based on your tips, I found a piece of code that can be implemented. Thank you for your help. Thank you.
    赵泽鑫 author 2022-01-25 22:56:31
赵泽鑫

Can you explain it in more detail? Thank you.

逆旅行人

Using css pseudo-classes

  • reply Can you explain it in more detail? Thank you.
    赵泽鑫 author 2022-01-13 16:34:18
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!