{"id":2683,"date":"2025-06-11T05:30:25","date_gmt":"2025-06-10T21:30:25","guid":{"rendered":"https:\/\/www.zhaozhao123.cn\/wpcms\/wpdt\/2683.html"},"modified":"2025-06-11T05:30:25","modified_gmt":"2025-06-10T21:30:25","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8wordpress%e4%b8%ad%e6%b7%bb%e5%8a%a0svg%e5%9b%be%e7%89%87%e6%96%87%e4%bb%b6%ef%bc%883%e7%a7%8d%e7%ae%80%e5%8d%95%e6%96%b9%e6%b3%95%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.zhaozhao123.cn\/wpcms\/post\/2683.html","title":{"rendered":"\u5982\u4f55\u5728WordPress\u4e2d\u6dfb\u52a0SVG\u56fe\u7247\u6587\u4ef6\uff083\u79cd\u7b80\u5355\u65b9\u6cd5\uff09"},"content":{"rendered":"<div class=\"wp-block-columns p-0 border is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-columns px-4 py-3 border-bottom has-background is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\" style=\"background:linear-gradient(243deg,rgb(238,238,238) 0%,rgba(58,166,242,0.15) 100%)\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\r\n<figure class=\"wp-block-image size-thumbnail is-resized is-style-rounded is-style-rounded--1\"><img decoding=\"async\" src=\"https:\/\/www.zhaozhao123.cn\/myitems\/images\/sites16\/2025\/06\/dyA-1-400x300.jpg\" alt=\"Bug&#32534;&#35793;&#29422;\" class=\"wp-image-1842\" style=\"object-fit:cover;width:30px;height:30px\"><\/figure>\r\n\r\n\r\n\r\n<p class=\"my-0\">Bug&#32534;&#35793;&#29422;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n\r\n<div class=\"wp-block-columns px-xl-5 px-4 py-xl-4 py-3 is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<p>&#22312;WordPress&#20013;&#28155;&#21152;SVG&#22270;&#29255;&#25991;&#20214;&#21487;&#20197;&#36890;&#36807;&#22810;&#31181;&#26041;&#24335;&#23454;&#29616;&#65292;&#20197;&#19979;&#26159;&#19977;&#31181;&#31616;&#21333;&#30340;&#26041;&#27861;&#65306;<\/p>\n<h3>&#26041;&#27861;&#19968;&#65306;&#36890;&#36807;&#19978;&#20256;SVG&#25991;&#20214;<\/h3>\n<ol>\n<li>\n<p><strong>&#19978;&#20256;SVG&#25991;&#20214;<\/strong>&#65306;<\/p>\n<ul>\n<li>&#30331;&#24405;&#21040;&#24744;&#30340;WordPress&#21518;&#21488;&#12290;<\/li>\n<li>&#36827;&#20837;&ldquo;&#23186;&#20307;&rdquo;&#33756;&#21333;&#19979;&#30340;&ldquo;&#28155;&#21152;&#26032;&#25991;&#20214;&rdquo;&#25110;&ldquo;&#25554;&#20837;&#23186;&#20307;&rdquo;&#36873;&#39033;&#12290;<\/li>\n<li>&#36873;&#25321;&ldquo;&#20174;&#35745;&#31639;&#26426;&#19978;&#28155;&#21152;&#25991;&#20214;&rdquo;&#65292;&#28982;&#21518;&#25214;&#21040;&#24182;&#19978;&#20256;&#24744;&#24819;&#35201;&#28155;&#21152;&#30340;SVG&#25991;&#20214;&#12290;<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>&#35774;&#32622;&#20026;&#40664;&#35748;&#22270;&#20687;<\/strong>&#65306;<\/p>\n<ul>\n<li>&#22312;&#19978;&#20256;&#23436;&#25104;&#21518;&#65292;&#28857;&#20987;&ldquo;&#20445;&#23384;&#26356;&#25913;&rdquo;&#25353;&#38062;&#12290;<\/li>\n<li>&#36716;&#21040;&ldquo;&#32534;&#36753;&rdquo;&#39029;&#38754;&#65292;&#25214;&#21040;&#35201;&#26367;&#25442;&#29616;&#26377;&#22270;&#29255;&#30340;&#20301;&#32622;&#12290;<\/li>\n<li>&#28857;&#20987;&ldquo;&#26367;&#25442;&rdquo;&#25353;&#38062;&#20197;&#24212;&#29992;&#26032;&#30340;SVG&#25991;&#20214;&#12290;<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>&#36825;&#31181;&#26041;&#27861;&#36866;&#29992;&#20110;&#31616;&#21333;&#30340;&#12289;&#38750;&#20132;&#20114;&#24335;&#30340;SVG&#22270;&#29255;&#12290;<\/p>\n<h3>&#31034;&#20363;&#20195;&#30721;&#19982;&#27493;&#39588;&#65306;<\/h3>\n<pre><code class=\"language-php\">\/\/ &#33719;&#21462;&#24403;&#21069;&#39029;&#38754;&#30340;ID\n$current_page_id = get_the_ID();\n\n\/\/ &#28155;&#21152;&#19968;&#20010;SVG&#22270;&#29255;&#21040;&#24403;&#21069;&#39029;&#38754;\nadd_image_size('svg', 64, 64);\n$image_url = wp_get_attachment_image_src(get_post_thumbnail_id($current_page_id), 'full');\n?&gt;\n&lt;img src=\"&lt;?php echo $image_url[0]; ?&gt;\" alt=\"SVG Image\" class=\"svg-image\"&gt;<\/code><\/pre>\n<h3>&#35299;&#37322;&#65306;<\/h3>\n<ul>\n<li><code>get_the_ID()<\/code>&#65306;&#33719;&#21462;&#24403;&#21069;&#39029;&#38754;&#30340;ID&#65292;&#29992;&#20110;&#30830;&#23450;&#22270;&#29255;&#20301;&#32622;&#12290;<\/li>\n<li><code>wp_get_attachment_image_src()<\/code>: &#33719;&#21462;&#38468;&#20214;&#65288;&#22312;&#36825;&#37324;&#26159;SVG&#22270;&#29255;&#65289;&#30340;URL&#12290;<\/li>\n<li><code>add_image_size()<\/code>&#65306;&#23450;&#20041;&#19968;&#20010;&#26032;&#30340;&#22270;&#29255;&#23610;&#23544;&#65292;&#36825;&#37324;&#25105;&#20204;&#23450;&#20041;&#20102;&#19968;&#20010;&#22823;&#23567;&#20026;64&#215;64&#20687;&#32032;&#30340;SVG&#22270;&#29255;&#12290;<\/li>\n<\/ul>\n<h3>&#26041;&#27861;&#20108;&#65306;&#36890;&#36807;&#23884;&#22871;HTML&#26631;&#31614;<\/h3>\n<ol>\n<li><strong>&#25554;&#20837;SVG&#20195;&#30721;<\/strong>&#65306;\n<ul>\n<li>&#25171;&#24320;&#24744;&#30340;WordPress&#21338;&#23458;&#12290;<\/li>\n<li>&#23548;&#33322;&#21040;&#24744;&#24076;&#26395;&#25918;&#32622;SVG&#22270;&#29255;&#30340;&#22320;&#26041;&#12290;<\/li>\n<li>&#25554;&#20837;&#20197;&#19979;HTML&#20195;&#30721;&#26469;&#23884;&#22871;SVG&#21644;CSS&#26679;&#24335;&#65306;<\/li>\n<\/ul><\/li>\n<\/ol>\n<pre><code class=\"language-html\">&lt;div style=\"display: flex; justify-content: center;\"&gt;\n    &lt;svg width=\"100%\" height=\"auto\" viewBox=\"0 0 512 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"&gt;\n        &lt;!-- SVG&#20869;&#23481; --&gt;\n    &lt;\/svg&gt;\n&lt;\/div&gt;<\/code><\/pre>\n<ol start=\"2\">\n<li><strong>&#32534;&#20889;SVG&#20195;&#30721;<\/strong>&#65306;\n<ul>\n<li>&#20351;&#29992; <code>&lt;svg&gt;<\/code> &#26631;&#31614;&#21019;&#24314;SVG&#20803;&#32032;&#12290;<\/li>\n<li>&#35774;&#32622;<code>width<\/code>&#21644;<code>height<\/code>&#23646;&#24615;&#26469;&#25511;&#21046;SVG&#30340;&#22823;&#23567;&#12290;<\/li>\n<li><code>viewBox<\/code> &#23646;&#24615;&#25351;&#23450;&#20102;SVG&#20803;&#32032;&#30340;&#23454;&#38469;&#26174;&#31034;&#21306;&#22495;&#12290;<\/li>\n<\/ul><\/li>\n<\/ol>\n<h3>&#31034;&#20363;&#20195;&#30721;&#19982;&#27493;&#39588;&#65306;<\/h3>\n<pre><code class=\"language-html\">&lt;div style=\"display: flex; justify-content: center;\"&gt;\n    &lt;svg width=\"100%\" height=\"auto\" viewBox=\"0 0 512 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"&gt;\n        &lt;circle cx=\"50%\" cy=\"50%\" r=\"48\" fill=\"#fff\"\/&gt;\n        &lt;rect x=\"25%\" y=\"25%\" width=\"70%\" height=\"70%\" fill=\"#fff\"\/&gt;\n    &lt;\/svg&gt;\n&lt;\/div&gt;<\/code><\/pre>\n<h3>&#35299;&#37322;&#65306;<\/h3>\n<ul>\n<li><code>&lt;svg&gt;<\/code>&#65306;&#21019;&#24314;SVG&#20803;&#32032;&#12290;<\/li>\n<li><code>width<\/code>, <code>height<\/code>, <code>viewBox<\/code>&#65306;&#35774;&#32622;SVG&#30340;&#22823;&#23567;&#21644;&#26174;&#31034;&#21306;&#22495;&#12290;<\/li>\n<li><code>&lt;circle&gt;<\/code> &#21644; <code>&lt;rect&gt;<\/code>&#65306;&#28155;&#21152;&#22270;&#24418;&#20803;&#32032;&#65292;&#22914;&#22278;&#24418;&#21644;&#30697;&#24418;&#12290;<\/li>\n<\/ul>\n<h3>&#26041;&#27861;&#19977;&#65306;&#36890;&#36807;&#38142;&#25509;&#24341;&#29992;SVG&#25991;&#20214;<\/h3>\n<ol>\n<li>\n<p><strong>&#19978;&#20256;SVG&#25991;&#20214;<\/strong>&#65306;<\/p>\n<ul>\n<li>&#21516;&#26679;&#22320;&#65292;&#23558;SVG&#25991;&#20214;&#19978;&#20256;&#21040;WordPress&#23186;&#20307;&#24211;&#12290;<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>&#38142;&#25509;SVG&#25991;&#20214;<\/strong>&#65306;<\/p>\n<ul>\n<li>&#22312;WordPress&#20013;&#65292;&#24744;&#21487;&#20197;&#23558;SVG&#25991;&#20214;&#20316;&#20026;&#38745;&#24577;&#22270;&#20687;&#25110;&#33258;&#23450;&#20041;&#22270;&#26631;&#30340;&#38142;&#25509;&#20351;&#29992;&#12290;<\/li>\n<li>&#21019;&#24314;&#19968;&#20010;&#25351;&#21521;SVG&#25991;&#20214;&#30340;&#38142;&#25509;&#65292;&#20363;&#22914;&#65306;\n<pre><code class=\"language-html\">&lt;a href=\"&lt;?php echo esc_url(esc_attr($file-&gt;guid)); ?&gt;\"&gt;\n &lt;img src=\"&lt;?php echo esc_url($file-&gt;guid); ?&gt;\" alt=\"SVG Icon\" \/&gt;\n&lt;\/a&gt;<\/code><\/pre><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3>&#31034;&#20363;&#20195;&#30721;&#19982;&#27493;&#39588;&#65306;<\/h3>\n<pre><code class=\"language-php\">&lt;?php \n$attachment_id = attachment_exists('path\/to\/your\/specific-svg-file.svg'); \/\/ &#26367;&#25442;&#20026;&#23454;&#38469;&#36335;&#24452;\nif ($attachment_id) {\n    $file = get_post_meta($attachment_id, '_wp_attached_file', true);\n    ?&gt;\n    &lt;a href=\"&lt;?php echo esc_url($file); ?&gt;\"&gt;\n        &lt;img src=\"&lt;?php echo esc_url($file); ?&gt;\" alt=\"SVG Icon\" \/&gt;\n    &lt;\/a&gt;\n    &lt;?php\n}\n?&gt;<\/code><\/pre>\n<h3>&#35299;&#37322;&#65306;<\/h3>\n<ul>\n<li><code>$attachment_id<\/code>&#65306;&#26681;&#25454;SVG&#25991;&#20214;&#30340;GUID&#26597;&#25214;&#20854;ID&#12290;<\/li>\n<li><code>get_post_meta()<\/code>&#65306;&#33719;&#21462;&#20851;&#32852;&#25968;&#32452;&#20013;&#30340;&#20540;&#12290;<\/li>\n<li><code>esc_url()<\/code>&#65306;&#38450;&#27490;SQL&#27880;&#20837;&#25915;&#20987;&#12290;<\/li>\n<\/ul>\n<p>&#20197;&#19978;&#23601;&#26159;&#19977;&#31181;&#22312;WordPress&#20013;&#28155;&#21152;SVG&#22270;&#29255;&#25991;&#20214;&#30340;&#22522;&#26412;&#26041;&#27861;&#65292;&#27599;&#31181;&#26041;&#27861;&#37117;&#26377;&#20854;&#36866;&#29992;&#22330;&#26223;&#12290;&#36873;&#25321;&#21738;&#31181;&#26041;&#27861;&#21462;&#20915;&#20110;&#24744;&#30340;&#20855;&#20307;&#38656;&#27714;&#21644;&#20559;&#22909;&#12290;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div><div class=\"wp-block-columns p-0 border is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-columns px-4 py-3 border-bottom has-background is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\" style=\"background:linear-gradient(243deg,rgb(238,238,238) 0%,rgba(58,166,242,0.15) 100%)\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\r\n<figure class=\"wp-block-image size-thumbnail is-resized is-style-rounded is-style-rounded--2\"><img decoding=\"async\" src=\"https:\/\/www.zhaozhao123.cn\/myitems\/images\/sites16\/2025\/06\/zp-400x300.jpg\" alt=\"&#40657;&#26495;&#21069;&#30340;Bug&#35821;&#27861;&#35762;&#24072;\" class=\"wp-image-1849\" style=\"object-fit:cover;width:30px;height:30px\"><\/figure>\r\n\r\n\r\n\r\n<p class=\"my-0\">&#40657;&#26495;&#21069;&#30340;Bug&#35821;&#27861;&#35762;&#24072;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n\r\n<div class=\"wp-block-columns px-xl-5 px-4 py-xl-4 py-3 is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<p>&#22312;WordPress&#20013;&#28155;&#21152;SVG&#22270;&#29255;&#25991;&#20214;&#26159;&#19968;&#31181;&#24120;&#35265;&#30340;&#38656;&#27714;&#65292;&#29305;&#21035;&#26159;&#24403;&#24744;&#38656;&#35201;&#20026;&#32593;&#31449;&#35774;&#35745;&#19968;&#20010;&#29420;&#29305;&#25110;&#22797;&#26434;&#30340;&#22270;&#24418;&#20803;&#32032;&#26102;&#12290;SVG&#65288;Scalable Vector Graphics&#65289;&#22270;&#20687;&#26684;&#24335;&#20855;&#26377;&#35768;&#22810;&#20248;&#28857;&#65292;&#21253;&#25324;&#21487;&#20197;&#32553;&#25918;&#20197;&#36866;&#24212;&#19981;&#21516;&#22823;&#23567;&#21644;&#20998;&#36776;&#29575;&#30340;&#23631;&#24149;&#65292;&#20197;&#21450;&#25903;&#25345;&#20016;&#23500;&#30340;&#39068;&#33394;&#21644;&#21160;&#30011;&#25928;&#26524;&#12290;<\/p>\n<p>&#20197;&#19979;&#26159;&#20351;&#29992;WordPress&#25552;&#20379;&#30340;&#20960;&#31181;&#26041;&#24335;&#26469;&#23454;&#29616;&#36825;&#20010;&#30446;&#26631;&#65306;<\/p>\n<h3>&#26041;&#27861;&#19968;&#65306;&#20351;&#29992;&#25554;&#20214;<\/h3>\n<h4>&#20351;&#29992;WordPress&#33258;&#24102;&#30340;&#25554;&#20214;<\/h4>\n<p>&#39318;&#20808;&#65292;&#30830;&#20445;&#24744;&#30340;WordPress&#29256;&#26412;&#33267;&#23569;&#26159;5.0&#21450;&#20197;&#19978;&#12290;&#23433;&#35013;&#24182;&#28608;&#27963;&#20197;&#19979;&#25554;&#20214;&#20043;&#19968;&#65306;<\/p>\n<ol>\n<li><strong>WooCommerce SVG Image<\/strong> &#8211; &#36825;&#20010;&#25554;&#20214;&#19987;&#38376;&#29992;&#20110;&#22788;&#29702;&#19982;SVG&#30456;&#20851;&#30340;&#22270;&#29255;&#21644;&#20135;&#21697;&#22270;&#29255;&#12290;<\/li>\n<li><strong>WPML SVG Importer<\/strong> &#8211; &#22914;&#26524;&#24744;&#38656;&#35201;&#23558;SVG&#23548;&#20837;&#21040;&#22810;&#35821;&#35328;&#32593;&#31449;&#19978;&#65292;&#35831;&#32771;&#34385;&#27492;&#25554;&#20214;&#12290;<\/li>\n<\/ol>\n<h4>&#31034;&#20363;&#20195;&#30721;:<\/h4>\n<pre><code class=\"language-php\">\/\/ &#20351;&#29992;WooCommerce SVG Image&#25554;&#20214;\nadd_action('admin_init', 'wpsvgs_import');\nfunction wpsvgs_import() {\n    \/\/ &#26816;&#26597;&#26159;&#21542;&#26377;&#19978;&#20256;&#30340;SVG&#25991;&#20214;\n    if (isset($_FILES['svg_file']) &amp;&amp; $_FILES['svg_file']['error'] === UPLOAD_ERR_OK) {\n        $file = wp_upload_dir()['basedir'] . '\/' . sanitize_file_name( $_FILES['svg_file']['name']);\n        move_uploaded_file($_FILES['svg_file']['tmp_name'], $file);\n        $svg_data = file_get_contents($file);\n\n        \/\/ &#21019;&#24314;&#19968;&#20010;&#26032;&#30340;WooCommerce&#21830;&#21697;\n        $product = wc_create_product(array(\n            'title' =&gt; 'My SVG Product',\n            'description' =&gt; 'This is a product with an SVG image.',\n            'sku' =&gt; 'my-svg-product',\n            'image' =&gt; array(\n                'id' =&gt; 1,\n                'sizes' =&gt; array(),\n                'url' =&gt; $file,\n            ),\n        ));\n    }\n}\n\n\/\/ &#20351;&#29992;WPML SVG Importer&#25554;&#20214;\nadd_action('wp_loaded', 'wmlsvgs_import');\nfunction wmlsvgs_import() {\n    \/\/ &#26816;&#26597;&#26159;&#21542;&#26377;&#19978;&#20256;&#30340;SVG&#25991;&#20214;\n    if (isset($_POST['import_svg'])) {\n        $upload_dir = wp_upload_dir();\n        $post_id = wp_insert_post(array(\n            'post_title' =&gt; sanitize_title( $_POST['post_title'] ),\n            'post_content' =&gt; sanitize_text_field( $_POST['post_content'] ),\n            'post_status' =&gt; 'publish',\n            'post_type' =&gt; 'post',\n            'post_author' =&gt; get_current_user_id()\n        ));\n\n        $svg_path = wp_upload_dir()['base_url'] . '\/images\/' . $post_id;\n        copy(ABSPATH . 'wp-content\/uploads\/svg.svg', $svg_path);\n\n        \/\/ &#23548;&#33322;&#21040;&#26032;&#21019;&#24314;&#30340;&#20135;&#21697;&#39029;&#38754;\n        wp_redirect( add_query_arg( 'slug', 'my-svg-product' ) );\n        exit();\n    }\n}<\/code><\/pre>\n<h3>&#26041;&#27861;&#20108;&#65306;&#36890;&#36807;WordPress&#32534;&#36753;&#22120;<\/h3>\n<p>&#34429;&#28982;&#36825;&#31181;&#26041;&#27861;&#19981;&#24120;&#29992;&#65292;&#20294;&#22914;&#26524;&#24744;&#24050;&#32463;&#29087;&#24713;&#20102;WordPress&#30340;&#32534;&#36753;&#22120;&#65292;&#20063;&#21487;&#20197;&#23581;&#35797;&#20351;&#29992;&#23427;&#26469;&#21152;&#36733;SVG&#25991;&#20214;&#12290;&#36825;&#36890;&#24120;&#36866;&#29992;&#20110;&#37027;&#20123;&#24819;&#35201;&#33258;&#23450;&#20041;&#32593;&#39029;&#22806;&#35266;&#30340;&#29992;&#25143;&#12290;<\/p>\n<h4>&#31034;&#20363;&#20195;&#30721;:<\/h4>\n<pre><code class=\"language-html\">&lt;!-- &#20351;&#29992;WordPress&#32534;&#36753;&#22120;&#21152;&#36733;SVG --&gt;\n&lt;div class=\"wrap\"&gt;\n    &lt;h2&gt;Upload your SVG image here&lt;\/h2&gt;\n    &lt;form action=\"\" method=\"post\" enctype=\"multipart\/form-data\"&gt;\n        &lt;input type=\"hidden\" name=\"action\" value=\"upload_svg_image\"\/&gt;\n        &lt;input type=\"text\" name=\"post_title\" placeholder=\"Title of the post\"\/&gt;\n        &lt;textarea name=\"post_content\"&gt;&lt;\/textarea&gt;\n        &lt;label for=\"svg_file\"&gt;Select SVG File:&lt;\/label&gt;&lt;br\/&gt;\n        &lt;input type=\"file\" id=\"svg_file\" name=\"svg_file\"\/&gt;\n        &lt;button type=\"submit\"&gt;Upload SVG Image&lt;\/button&gt;\n    &lt;\/form&gt;\n&lt;\/div&gt;<\/code><\/pre>\n<h3>&#26041;&#27861;&#19977;&#65306;&#20351;&#29992;JavaScript<\/h3>\n<p>&#23545;&#20110;&#26356;&#31616;&#21333;&#30340;HTML\/JS&#35299;&#20915;&#26041;&#26696;&#65292;&#24744;&#21487;&#20197;&#32534;&#20889;&#19968;&#20010;&#31616;&#21333;&#30340;&#33050;&#26412;&#26469;&#21152;&#36733;SVG&#25991;&#20214;&#12290;&#36825;&#31181;&#26041;&#27861;&#19981;&#38656;&#35201;&#20219;&#20309;&#39069;&#22806;&#30340;&#25554;&#20214;&#65292;&#20294;&#21487;&#33021;&#19981;&#26159;&#26368;&#25512;&#33616;&#30340;&#26041;&#27861;&#65292;&#22240;&#20026;&#23427;&#21487;&#33021;&#20250;&#22686;&#21152;&#26381;&#21153;&#22120;&#36127;&#36733;&#12290;<\/p>\n<h4>&#31034;&#20363;&#20195;&#30721;:<\/h4>\n<pre><code class=\"language-javascript\">\/\/ &#33719;&#21462;SVG&#25991;&#20214;URL\nvar svgUrl = document.getElementById(\"svg_file\").files[0].path;\n\n\/\/ &#23558;SVG&#25968;&#25454;&#25554;&#20837;&#21040;&#25991;&#26723;&#20013;\ndocument.body.innerHTML += '&lt;img src=\"' + svgUrl + '\" alt=\"SVG Image\"&gt;';<\/code><\/pre>\n<p>&#36825;&#20123;&#31034;&#20363;&#20195;&#30721;&#23637;&#31034;&#20102;&#22914;&#20309;&#22312;WordPress&#20013;&#21152;&#36733;SVG&#22270;&#29255;&#25991;&#20214;&#30340;&#19981;&#21516;&#26041;&#27861;&#12290;&#36873;&#25321;&#26368;&#36866;&#21512;&#24744;&#39033;&#30446;&#38656;&#27714;&#30340;&#26041;&#27861;&#65292;&#24182;&#26681;&#25454;&#23454;&#38469;&#24773;&#20917;&#35843;&#25972;&#20195;&#30721;&#12290;&#24076;&#26395;&#36825;&#23545;&#24744;&#26377;&#25152;&#24110;&#21161;&#65281;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Bug&#32534;&#35793;&#29422; &#22312;WordPress&#20013;&#28155;&#21152;SVG&#22270;&#29255;&#25991;&#20214;&#21487;&#20197;&#36890;&#36807;&#22810;&#31181;&#26041;..<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[59],"tuisongtax":[],"class_list":["post-2683","post","type-post","status-publish","format-standard","hentry","category-wpdt","tag-pzjc"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts\/2683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/comments?post=2683"}],"version-history":[{"count":0,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts\/2683\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/media?parent=2683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/categories?post=2683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tags?post=2683"},{"taxonomy":"tuisongtax","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tuisongtax?post=2683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}