
如何将Ajax实时搜索添加到您的WordPress
_oembed_create_xml ( $data, $node = null )
_oembed_create_xml: 此函数用于创建oEmbed响应的XML表示。
从一个给定的数组创建一个XML字符串。
function _oembed_create_xml( $data, $node = null ) { if ( ! is_array( $data ) || empty( $data ) ) { return false; } if ( null === $node ) { $node = new SimpleXMLElement( '<oembed></oembed>' ); } foreach ( $data as $key => $value ) { if ( is_numeric( $key ) ) { $key = 'oembed'; } if ( is_array( $value ) ) { $item = $node->addChild( $key ); _oembed_create_xml( $value, $item ); } else { $node->addChild( $key, esc_html( $value ) ); } } return $node->asXML(); }