亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

有沒有辦法在許多頁面 php 中顯示徽標?

有沒有辦法在許多頁面 php 中顯示徽標?

PHP
九州編程 2021-11-13 16:50:49
我已經在 header.php 上寫了一個代碼 logo/img但是,當我要刷新時,不想顯示徽標。有解決辦法嗎?我使用了 bootstrap 4,簡單的 html 和 css。我已經嘗試了很多次,但總是失敗。在任何功能中,徽標已經顯示,但在“tambahalternatif”中不想顯示這是我的控制器:<?php    class Alternatif extends CI_Controller{        public function __construct()        {            parent::__construct();            $this->load->model('Alternatif_model');            $this->load->library('form_validation');        }        public function index()        {            $data ['judul'] = 'Isi Alternatif';            $data ['alternatif'] = $this->Alternatif_model->getAllAlternatif();            if($this->input->post('key')){                $data['alternatif'] = $this->Alternatif_model->cariDataAlternatif();            }            $data['hasil'] = $this->Hitung(); //Manggil fungsi Hitung()             $this->load->view('templates/header',$data);            $this->load->view('alternatif/index', $data);            $this->load->view('templates/footer' );        }        public function tambahalternatif()        {            $data['judul'] = 'Form Tambah Data Alternatif';            // $this->form_validation->set_rules('idclient','ID','required|numeric');            $this->form_validation->set_rules('namaalt','NAMA','required');            if ($this->form_validation->run() == FALSE) {            $this->load->view('templates/header', $data);            $this->load->view('alternatif/tambahalternatif');            $this->load->view('templates/footer');        } else {            $this->Alternatif_model->tambahDataAlternatif();            $this->session->set_flashdata('flash','Berhasil');            redirect('alternatif');         }標題視圖<nav class="navbar navbar-expand-lg navbar-light bg-light navbar-fixed-top ml-right"><div class="container"><a class="navbar-brand" href="<?=base_url(); ?>" ><img class="logo" src="./img/logo.png" height="28px;" padding="2px 10px;></a>   我希望圖像(徽標)將顯示在“tambahalternatif”中,但圖像(徽標)僅顯示在“alternatif”中
查看完整描述

3 回答

?
慕娘9325324

TA貢獻1783條經驗 獲得超4個贊

使用基本路徑而不是絕對路徑。

代替

<img class="logo" src="./img/logo.png" height="28px;" padding="2px 10px;>

用下面的線

<img class="logo" src="<?php echo base_url(); ?>img/logo.png" height="28px;" padding="2px 10px;>

這樣當您更改視圖的路徑時,徽標的路徑就無需更改。


查看完整回答
反對 回復 2021-11-13
?
料青山看我應如是

TA貢獻1772條經驗 獲得超8個贊

***Try this one & let us know is it ok now.

Thanks.***


<nav class="navbar navbar-expand-lg navbar-light bg-light navbar- 

fixed-top ml-right">


<div class="container">


    <a class="navbar-brand" href="<?= base_url(); ?>" >

        <img class="logo" src="<?= base_url().'img/logo.png'; ?>" 

        height="28px" padding="2px 10px">

    </a>


</div>


</nav>


查看完整回答
反對 回復 2021-11-13
?
三國紛爭

TA貢獻1804條經驗 獲得超7個贊

在標題中嘗試此代碼


<body>

<img src="<?php echo base_url();?>imag/logo.png" height="28px" alt="">  

</body>


查看完整回答
反對 回復 2021-11-13
  • 3 回答
  • 0 關注
  • 172 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號