我有这个
$content = "loose text{{comments}} = {{yolo}}{{comments}} = {{yolo2}}{{comment}} = {{yolo3}}{{comment}} = {{yolo4}}loose text2";我想摆脱这些括号。我在某处读到,为了逃避它,你将它们加倍,但即使这样,它也不起作用。
我得到了
Cannot convert value "loose text{{comments}} = {{yolo}}{{comments}} = {{yolo2}}{{comment}} = {{yolo3}}{{comment}} = {{yolo4}}loose text2" to type "System.Xml.XmlDocument". Error: "The specified node cannot be inserted as the valid child of this node,
because the specified node is the wrong type."
At line:1 char:1
+ $content = "loose text{{comments}} = {{yolo}}{{comments}} = {{yolo2}}{{comment}} ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : RuntimeException发布于 2019-11-06 06:18:19
PS中的转义字符是"back-tic“= `。但是,在所给出的代码中,字符串中只包含{}应该不会有任何问题。
在任何需要转义它的情况下,只需使用下面的示例:
$content = "loose text`{comments`} = `{yolo`}`{comments`} = `{yolo2`}`{comment`} = `{yolo3`}`{comment`} = `{yolo4`}loose text2"https://stackoverflow.com/questions/58717254
复制相似问题