链接目录加倍

时间:2017-10-21 15:48:09

标签: php html bootstrap-4

我有这样的目录" localhost / site / folder1 / file.php",我需要访问来自" site"的file.php。这样的目录

href = "folder1/file.php"

不幸的是它需要我

href = "folder1/folder1/file.php"

当我访问" index.php"文件位于" site"目录来自" folder1",这样

href = "../index.php"

它带我到c中的根目录:我的意思是这样

href = "localhost/index.php".

我已经把这个问题堆了两天了,请任何人帮我解决这个问题。

注意:我正在使用bootstrap框架

更多编辑...

这是完整的代码。

<section>
  <section class="hbox stretch">
    <!-- .aside -->
    <aside class="bg-black dk nav-xs aside hidden-print" id="nav">          
      <section class="vbox">
        <section class="w-f-md scrollable">
          <div class="slim-scroll" data-height="auto" data-disable-fade-out="true" data-distance="0" data-size="10px" data-railOpacity="0.2">
            <!-- nav     -->             
            <nav class="nav-primary hidden-xs">
              <ul class="nav bg clearfix" data-ride="collapse">
                <!--<li class="hidden-nav-xs padder m-t m-b-sm text-xs text-muted">
                  Discover
                </li>-->
                <li>
                  <a href= "../index.php">
                    <i class="icon-home icon text-success"></i>
                    <span class="font-bold">Home</span>
                  </a>
                </li>
                <li>
                    <a href="#" class="auto">
                        <span class="pull-right text-muted">
                          <i class="fa fa-angle-left text"></i>
                          <i class="fa fa-angle-down text-active"></i>
                        </span>
                        <i class="icon-music-tone-alt icon text-info"></i>
                        <span class="font-bold">Audios</span>
                    </a>
                    <ul class="nav dk text-sm">
                        <li >
                          <a href="../general.php" class="auto">                                                        
                            <i class="fa fa-angle-right text-xs"></i>
                            <span>Speaches</span>
                          </a>
                        </li>
                        <li >
                          <a href="../general.php" class="auto">                                                        
                            <i class="fa fa-angle-right text-xs"></i>
                            <span>Preaches</span>
                          </a>
                        </li>
                        <li >
                          <a href="../general.php" class="auto">                                                        
                            <i class="fa fa-angle-right text-xs"></i>
                            <span>Interviews</span>
                          </a>
                        </li>
                        <li >
                          <a href="../general.php" class="auto">                                                        
                            <i class="fa fa-angle-right text-xs"></i>
                            <span>Songs</span>
                          </a>
                        </li>
                    </ul>
                </li>
                <li>
                  <a href="#" class="auto">
                        <span class="pull-right text-muted">
                          <i class="fa fa-angle-left text"></i>
                          <i class="fa fa-angle-down text-active"></i>
                        </span>
                    <i class="icon-book-open icon text-primary-lter"></i>
                    <span class="font-bold">Writtings</span>
                  </a>
                  <ul class="nav dk text-sm">
                        <li >
                          <a href="../general.php" class="auto">                                                        
                            <i class="fa fa-angle-right text-xs"></i>
                            <span>Books</span>
                          </a>
                        </li>
                        <li >
                          <a href="../general.php" class="auto">                                                        
                            <i class="fa fa-angle-right text-xs"></i>
                            <span>Jounals</span>
                          </a>
                        </li>
                    </ul>
                </li>
                <li>
                  <a href="#">
                    <i class="icon-users icon text-primary-lter"></i>
                    <span class="font-bold">Artists</span>
                  </a>
                </li>
                <li>
                  <a href="#">
                    <i class="icon-film icon  text-info-dker"></i>
                    <span class="font-bold">Albums</span>
                  </a>
                </li>
                <li class="m-b hidden-nav-xs"></li>
              </ul>
              <ul class="nav" data-ride="collapse">
                <li class="hidden-nav-xs padder m-t m-b-sm text-xs text-muted">
                  User Account
                </li>
                <li>
                    <?php
                        if(!isset ($_SESSION['email'])){
                            echo "
                                <a href='../signin.php' class='auto'>
                                    <i class='icon-login icon'>
                                    </i>
                                    <span>Signin</span>
                                </a>
              </li>
                <li >
                  <a href='../signup.php' class='auto'>
                    <i class='fa fa-smile-o'>
                    </i>
                    <span>Signup</span>
                  </a>
                </li>
                              ";

                        }else{
                            echo "
                                <a href='../signout.php' class='auto'>
                                    <i class='icon-logout icon'>
                                    </i>
                                    <span>SignOut</span>
                                </a>
              </li>";

              if (!isset($_SESSION['admin_name'])) {
                  echo "
                  <li >
                    <a href='profile.php' class='auto'>
                      <i class='fa fa-smile-o'>
                      </i>
                      <span>My profile</span>
                    </a>
                  </li>
                ";
              }else{
                echo "
                  <li >
                    <a href='MembersManagement.php' class='auto'>
                      <i class='fa fa-edit'>
                      </i>
                      <span>Manage Member</span>
                    </a>
                  </li>
                  <li >
                    <a href='admin.php' class='auto'>
                      <i class='fa fa-edit'>
                      </i>
                      <span>My Dashboard</span>
                    </a>
                  </li>
                ";
              }

                        }
                    ?>


              </ul>
            </nav>
            <!-- / nav ---->
          </div> 
        </section>

问题出在这一行

<nav class="nav-primary hidden-xs">

当我删除&#34; nav-primary&#34;一切都很好用锚()但它改变了部分的外观和安排,我该怎么办,我是新的引导框架。

1 个答案:

答案 0 :(得分:0)

如果您遇到相对网址问题,可以尝试使用绝对网址:

href = "localhost/site/folder1/file.php".

而另一个你也可以这样做:

href = "localhost/site/index.php

也许这有帮助。