我想使用高级自定义字段显示我从管理面板中获取的SVG徽标。然后,徽标显示如下,
<?php $logo = get_field('svg_logo'); ?>
<?php echo file_get_contents($logo); ?>
现在此代码显示以下错误,
Warning:: file_get_contents(&lt;svg xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:cc=&quot;http://creativecommons.org/ns#&quot; xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:svg=&quot;http://www.w3.org/2000/svg&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; xmlns:sodipodi=&quot;http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd&quot; xmlns:inkscape=&quot;http://www.inkscape.org/namespaces/inkscape&quot; height=&quot;206.25000&quot; id=&quot;svg2&quot; version=&quot;1.0&quot; width=&quot;406.25000&quot; x=&quot;0.00000000&quot; y=&quot;0.00000000&quot; sodipodi:version=&quot;0.32&quot; inkscape:version=&quot;0.46&quot; sodipodi:docname=&quot;AJ_Digital_Camera_ok.svg&quot; inkscape:output_extension=&quot;org.inkscape.output.svg.inkscape&quot; inkscape:export-filename=&quot;C:j in.
编辑:
我做了一个var_dump,它显示了以下内容,
string(156495) "<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg' xmlns="http://www.w3.org/2000/svg' xmlns:xlink="http://www.w3.org/1999/xlink' xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape' height="206.25000' id="svg2' version="1.0' width="406.25000' x="0.00000000' y="0.00000000' sodipodi:version="0.32' inkscape:version="0.46' sodipodi:docname="AJ_Digital_Camera_ok.svg' inkscape:output_extension="org.inkscape.output.svg.inkscape' inkscape:export-filename="C:joannaGfxdrawings_vectoradminthumbsAJ_Digital_Camera_ok.png' inkscape:export-xdpi="55.827694' inkscape:export-ydpi="55.827694">
答案 0 :(得分:1)
如果您选择textarea进行输入,则不会自动选择将标签转换为html。从高级自定义字段选项中选择将所有标记转换为html。