我的程序实际上试图做的是从 xml 文件(曾经是 svg 文件)中获取数据。并以此从 xml 标签中获取相关信息作为属性和值。我的 php 设置是这样的
foreach($xml_file_open->g->path[0]->attributes() as $attribute => $value)
{
echo $attribute => $value
}
xml_file_open 属性请求的输出是
style="fill:#ff0000;fill-rule:evenodd;stroke:#000000;
stroke-width:1px;stroke-linecap:butt;stroke-linejoin:
miter;stroke-opacity:1"
id="path2987"
d="m 631.42859,603.79077 a 212.85715,162.85715 0 1 1
-425.7143,0 212.85715,162.85715 0 1 1 425.7143,0 z"
(3 行样式和 d 被故意拆分以提高可读性)而不是获取这 3 行数据,我试图获取此标签中的所有内容
<path
sodipodi:type="arc"
style="fill:#ff0000;fill-rule:evenodd;stroke:#000000;stroke-width:1px;
stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="path2987"
sodipodi:cx="418.57144"
sodipodi:cy="603.79077"
sodipodi:rx="212.85715"
sodipodi:ry="162.85715"
d="m 631.42859,603.79077 a 212.85715,162.85715 0 1 1
-425.7143,0 212.85715,162.85715 0 1 1 425.7143,0 z" />
它似乎是 sodipodi: 它不会作为属性读取,我如何让它读取 sodipodi:cx/cy 等作为属性?