PHP Codeigniter Base_URL

时间:2017-02-12 04:02:26

标签: php codeigniter

请帮忙。

几乎完成了我的最终项目..

不知何故,画廊遇到了显示它的图片的错误,我认为这是因为base_url

<?php
        //FOLDER GALLERY-PART
            $dirname = "./assets/images/gallery/";
            $images = glob($dirname."*.jpg");

            array_multisort(array_map('filemtime', $images), SORT_NUMERIC, SORT_DESC, $images);

            foreach($images as $image) {
                echo //'<img src="'.$image.'" /><br />'; -- Ini cth untuk tampilkan semua gambar (dlm Garis lurus)

        "<div class='col-xs-6 col-sm-4 col-md-3 portfolio-item logos'>
            <div class='portfolio-wrapper'>
                <div class='portfolio-single'>
                    <div class='portfolio-thumb'>
                    <img src='.$image.' class='img-responsive' alt=''>
                    </div>
                    <form id='imgtitle' class='kart' action='" . base_url() . "gallery/delete' method='post'>
                    <div class='portfolio-view'>
                        <ul class='nav nav-pills'>
                            <li><a href='#'><i class='fa fa-link'></i></a></li>
                            <li><a href='.$image.' data-lightbox='example-set'><i class='fa fa-eye'></i></a></li>
                            <li><a href='#'><i class='fa fa-heart'></i></a></li>
                        </ul>
                    </div>
                    </form>
                </div>
                <div class='portfolio-info'>
                    <form id='imgtitle' class='kart' action='" . base_url() . "gallery/delete' method='post'>
                        <input type = 'hidden' name='delete_file' value='$image' />";?>
                        <?php if($_SESSION['admin']==1):?>  
                            <button type = 'submit' class='btn btn-danger'><i class='delete fa fa-trash fa-3x'></i></button>
                        <?php endif; ?>
                <?="</form>
                </div>
            </div>
        </div>";
    }
  ?>

如何将base_url置于

$dirname

还是其他任何建议?

2 个答案:

答案 0 :(得分:0)

&#13;
&#13;
$dirname = "./assets/images/gallery/";
            $images = glob($dirname."*.jpg");`
echo '<img src="'.$baseurl/$image.'" /><br />'; ?>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

试试这个:

<img src='".base_url()$image."' class='img-responsive' alt=''>