Answer the question
In order to leave comments, you need to log in
Removing some text with PHP
I will make a reservation that I am still a lamer in PHP.
Let's say we have a link:
<a href="#" title="Title">Link</a>
title="Title"
Answer the question
In order to leave comments, you need to log in
With qJerry , working with XML in PHP is as easy as working with jQuery in Javascript with HTML.
Here is the code:
q('<a href="#" title="Title">Link</a>')->removeAttr('title')->dump();
outputs:<?xml version="1.0"?>
<a href="#">Link</a>
Something like this, I haven't tested it, but it should work:
str_replace('<a href="#" title="Title">Link</a>','<a href="#">Link</a>',$Text);
Install the engine to work with the DOM as described above. There is also an alternative to use JS, but I'm not entirely sure if this is appropriate in your case (JS will work after generating the html code).
People, but there is an html parser, it is still used on Habré ... There you can set allowed tags and attributes. What is it called?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question