Get the App
SLTechnology News&Howtos  ›  Development  › 

Can php replace the text content of html?

Shulou Source: shulou.com Published: 2022-06-03 10:39:20 11月15日 Update

Whether php can replace the text content of html, this article introduces the corresponding analysis and answer in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

Php can replace the text content of html, the replacement method is: 1, through the "preg_match_all ($pattern,htmlspecialchars_decode ($a)...);" method replacement; 2, through the preg_replace_callback method replacement.

This article operating environment: Windows7 system, PHP7.1, Dell G3 computer.

Can php replace the text content of html?

Php replaces the contents of html

It is known that the following html

$a = "

\"1.png\"/

\"undefined\"/

\"undefined\"/

\"undefined\"/

\"undefined\"/

"

There are http and https and local relative path url in it.

Common usage:

$pattern= "/

Tags: Content methods text questions more help loops answers easy easy personal code functions guys buddies effects time environment computer knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Huawei Shulou Information Apple Shulou Technology