在 php 中我有一個問題,在某些字符串中我需要先從<!to 中刪除><?xml version="1.0" encoding="UTF-8"?><!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd"><cXML xml:lang="en-US" payloadID="[email protected]" timestamp="2000-01-08T23:00:06-08:00"> <Header>推薦哪個更好用,可能是一些標準功能,也可能是一些自定義建議。感謝您的幫助。
1 回答

holdtom
TA貢獻1805條經驗 獲得超10個贊
我會說一些類似的話
$string = "hello there
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd">
nice to meet you
and others text";
$string = preg_replace( "/<!.*?>/", "", $string );
echo $string;
- 1 回答
- 0 關注
- 155 瀏覽
添加回答
舉報
0/150
提交
取消