如何在php中打印@<something>?

How to print @<something> in php?

我有一个字符串,像这样:

sed -i 's@<serverport>[0-9]\+</serverport>@<serverport>".self::$serverPort."</serverpot>@' ".self::$configFile

我想用这个字符串发送 SSH 命令。但是如果我尝试回显它,结果将是:

sed -i 's@[0-9]\+@7777@' /folder/to/server/mods/deathmatch/mtaserver.conf

如何发送带有正确字符串的 SSH 命令?

如果您在 HTML 网页上打印此内容,<something> 将被视为 HTML 标签。如果您要回显的内容不是 HTML,但包含这些特殊字符,您需要对它们进行编码,以便显示它们而不是由浏览器解释。为此使用 htmlentities()

echo htmlentities($command);