我在一个看起来像这样的变量中有一个 XML 块:
<DailySchedule ID="1363108332926" Name="Daily Backup" Hour="11" Minute="0" Duration="-1" BackupType="FILE" LastUpdated="1363108332926" Interval="-1" EnableSkipBackup="N"/><DailySchedule ID="1363699291763" Name="Schedule3" Hour="21" Minute="0" Duration="-1" BackupType="FILE" LastUpdated="1363699291763" Interval="-1" EnableSkipBackup="N"/><WeeklySchedule ID="1363697754949" Name="Schedule0" Sun="N" Mon="Y" Tue="Y" Wed="N" Thu="N" Fri="N" Sat="N" Hour="21" Minute="0" Duration="-1" BackupType="FILE" LastUpdated="1363697754949" Interval="-1" EnableSkipBackup="N"/><MonthSchedule ID="1363698082481" Name="Schedule1" Occurrence="Last" Criteria="Weekday" Date="0" Hour="21" Minute="0" Duration="-1" BackupType="FILE" LastUpdated="1363698082481" EnableSkipBackup="N"/>
根据计划的 ID,我需要从字符串中删除整个 XML 块。例如,如果我的 ID 为 1363697754949,我需要删除<WeeklySchedule ID="1363697754949" Name="Schedule0" Sun="N" Mon="Y" Tue="Y" Wed="N" Thu="N" Fri="N" Sat="N" Hour="21" Minute="0" Duration="-1" BackupType="FILE" LastUpdated="1363697754949" Interval="-1" EnableSkipBackup="N"/>
我已经尝试过str_replace('1363697754949', '', $xmlString);
,但这只会删除实际数字。我需要删除整个 XML 标记。我可以使用某种通配符或其他模式来完成此操作吗?谢谢!