簡體   English   中英

無法顯示網頁上從PHP中的FTP服務器獲取的圖像

[英]Unable to show images on my web page fetching from FTP server in PHP

我無法查看頁面上的圖像,嘗試從FTP獲取圖像,但是無法查看圖像。 我創建了本地FTP並從本地服務器獲取圖像並創建了圖像庫,並在上載的文件夾中使用了多個復選框傳輸圖像后,但是這次我無法在網頁上查看圖像,我是php的新手。

    <?php
    $qt_folder_name = 'images'; // change this to a folder of your choice for images
            $qt_handle = opendir( dirname( realpath( __FILE__ ) ) . '/' . $qt_folder_name . '/' );

/* ========================================================================== */
/* ========================================================================== */
/*                                    FTP LOGIC                                   */


/* ========================================================================== */

            $qt_counter = 0;



            while( $qt_file = readdir( $qt_handle ) ) :

                if( $qt_file !== '.' && $qt_file !== '..' ) :

                    $qt_counter++;

                    $qt_file_path = $qt_folder_name . '/' . $qt_file;

                    ?>
<!-- ======================================================================= -->                    
          <?php
           $exp=  explode('!',$qt_file);
           ?>
<!-- ======================================================================= -->

                    <div class="qt-photo-gallery-item qt-image-no-<?php echo $qt_counter; ?>">
                        <a class="qt-photo-gallery-item-link" href="<?php echo $qt_file_path; ?>"title="<?php echo $exp[0]."\n".$exp[1]; ?><?php //echo $qt_file;?>">

                            <div class="qt-photo-gallery-item-image-wrapper">

                                <img src="<?php echo $qt_file_path; ?>" class="qt-photo-gallery-item-image" />
                                <p class="title_name"><?php echo $exp[0]."\n".$exp[1]; ?></p>
                            </div>


                        </a>
                    </div>

<!-- ======================================================================= -->

                    <?php

                    if( $qt_counter == 5 ) {
                        $qt_counter = 0;
                    }

                endif;

            endwhile;

/* ========================================================================== */

            ?>

乍看起來,在img src =中,您是從文件系統而不是從網站的索引目錄中引用圖像的路徑,這可能會導致問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM