php
  • codeigniter
  • 2015-08-28 95 views 0 likes 
    0

    我有单独的管理后端的URL和frontend.my文件结构如下所示。 [1]:http://i.stack.imgur.com/55I3U.png在管理文件夹中有应用系统文件夹和css图像等 前端url - localhost/abc 后端url - localhost/abc/admin 现在我想要显示图片在前端从上传文件夹管理夹。从另一个base_url显示图像

    我该怎么做。

    <?php echo "<img src='" . base_url().$post->image."' width=150px; height=100px;>";?> 
    

    根据这部分视图base url是localhost/abc。

    现在我想添加insn前端基地url的后端url。

    视图

    <?php if($post) { ?> 
        <?php foreach($post as $post){?> 
        <tr> 
        <td><?php echo $post->id ; echo '&nbsp; &nbsp;';?></td> 
        <!--<td><?php echo $post->image ; echo '&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;'?></td>--> 
          <td><?php echo "<img src='" . base_url().$post->image."' width=150px; height=100px;>";?></td></td> 
        </tr> 
        <?php } 
        } else { 
    
         ?> 
        <tr><td clospan="4" align="center">No records found to display</td></tr> 
    
    
        <?php } ?> 
    

    控制器

    public function index(){ 
    
    $data['post'] = $this->floor_model->get_plan(); // calling Post model method getPosts() 
         $this->load->view('user_include/header'); 
         $this->load->view('plan/floor',$data); 
        } 
    

    模型

    function get_plan(){ 
    
    
    $this->db->select("floor_plan.id,floor_plan.image"); 
    $this->db->where("user_id",$this->session->userdata['logged_in']['id']); 
    $this->db->from('floor_plan'); 
    $query = $this->db->get(); 
    return $query->result(); 
    
    
    } 
    
    +0

    检查这部分代码,<?php foreach($ post as $ post){?> – sriharichander

    +0

    我想更改基本网址 – ashik

    +0

    尝试获取基本url的当前网址http://stackoverflow.com/questions/12248970/codeigniter-get-current-url-relative-to-base-url – Farhan

    回答

    0
    <td><?php echo "<img src='".base_url().'admin'.$post->image."' width=150px; height=100px;>";?></td> 
    
    相关问题