我正在使用simple_html_dom來爬取網站,並且需要在 - > innertext和 - >明文之間的某個結果。只能使用PHP在html字符串中留下一些標籤
例如,這裏是源字符串:
<span lang="EN-CA">[28]<span style="font:7.0pt "Times New Roman""> </span></span><span lang="EN-CA">The Canadian trade-marks regime is national in scope. The owner of a registered trade-mark, subject to a finding of invalidity, is entitled to the exclusive use of that mark in association with the wares or services to which it is connected throughout Canada. Section 19 of the <i>Trade-marks Act</i> provides:</span>
我需要擺脫span
標籤的,但不是他們的內容(除非span
只包含
的),但保留<i>
,<u>
和<b>
的
所以我想在這裏實現的結果將是一個字符串:
[28] The Canadian trade-marks regime is national in scope. The owner of a registered trade-mark, subject to a finding of invalidity, is entitled to the exclusive use of that mark in association with the wares or services to which it is connected throughout Canada. Section 19 of the <i>Trade-marks Act</i> provides:
謝謝。這正是我需要的! –