Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从数组中提取图像_Php_Wordpress_Simple Html Dom - Fatal编程技术网

Php 从数组中提取图像

Php 从数组中提取图像,php,wordpress,simple-html-dom,Php,Wordpress,Simple Html Dom,你好,下面是代码,我得到了一些内容。 如何使用php简单html dom获得所有img src 我的代码: foreach($html->find('div[class=post-single-content box mark-links]') as $table) { $arr44[]= $table->innertext ; } 带有类post单个内容框标记链接的div包含文本和图像尝试以下操作: <?php if ( $post->post_type == 'd

你好,下面是代码,我得到了一些内容。 如何使用php简单html dom获得所有img src

我的代码:

foreach($html->find('div[class=post-single-content box mark-links]') as $table)
{
$arr44[]=  $table->innertext ;
}
带有类post单个内容框标记链接的div包含文本和图像

尝试以下操作:

<?php if ( $post->post_type == 'data-design' && $post->post_status == 'publish' ) {
    $attachments = get_posts( array(
        'post_type' => 'attachment',
        'posts_per_page' => -1,
        'post_parent' => $post->ID,
        'exclude'     => get_post_thumbnail_id()
    ) );

    if ( $attachments ) {
        foreach ( $attachments as $attachment ) {
            $class = "post-attachment mime-" . sanitize_title( $attachment->post_mime_type );
            $thumbimg = wp_get_attachment_link( $attachment->ID, 'thumbnail-size', true );
            echo '<li class="' . $class . ' data-design-thumbnail">' . $thumbimg . '</li>';
        }

    }
}
?>


im sur另一个网站不介意你窃取他们的内容该代码从一篇文章内容中提取所有图像。