1. <small id='L6RFg'></small><noframes id='L6RFg'>

      <i id='L6RFg'><tr id='L6RFg'><dt id='L6RFg'><q id='L6RFg'><span id='L6RFg'><b id='L6RFg'><form id='L6RFg'><ins id='L6RFg'></ins><ul id='L6RFg'></ul><sub id='L6RFg'></sub></form><legend id='L6RFg'></legend><bdo id='L6RFg'><pre id='L6RFg'><center id='L6RFg'></center></pre></bdo></b><th id='L6RFg'></th></span></q></dt></tr></i><div id='L6RFg'><tfoot id='L6RFg'></tfoot><dl id='L6RFg'><fieldset id='L6RFg'></fieldset></dl></div>
    2. <tfoot id='L6RFg'></tfoot>

          <bdo id='L6RFg'></bdo><ul id='L6RFg'></ul>
      1. <legend id='L6RFg'><style id='L6RFg'><dir id='L6RFg'><q id='L6RFg'></q></dir></style></legend>

        PHP使用包含在页面上设置活动链接

        PHP set active link on page using includes(PHP使用包含在页面上设置活动链接)

        <small id='4O50D'></small><noframes id='4O50D'>

      2. <legend id='4O50D'><style id='4O50D'><dir id='4O50D'><q id='4O50D'></q></dir></style></legend>

            <i id='4O50D'><tr id='4O50D'><dt id='4O50D'><q id='4O50D'><span id='4O50D'><b id='4O50D'><form id='4O50D'><ins id='4O50D'></ins><ul id='4O50D'></ul><sub id='4O50D'></sub></form><legend id='4O50D'></legend><bdo id='4O50D'><pre id='4O50D'><center id='4O50D'></center></pre></bdo></b><th id='4O50D'></th></span></q></dt></tr></i><div id='4O50D'><tfoot id='4O50D'></tfoot><dl id='4O50D'><fieldset id='4O50D'></fieldset></dl></div>

            • <tfoot id='4O50D'></tfoot>
                <bdo id='4O50D'></bdo><ul id='4O50D'></ul>
                  <tbody id='4O50D'></tbody>
                1. 本文介绍了PHP使用包含在页面上设置活动链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  所以我搜索了一个小时试图找到答案,还尝试了各种方法,包括这个

                  So I have searched SO for an hour trying to find the answer, and also tried various methods, including this

                  我正在尝试包含我的页面以及导航.但是在正确的页面上,我需要列表项有一个 active 类.导航在 header.php 中,目前看起来像这样:

                  I am trying to include my pages, along with the navigation. But on the correct page, I need the list-item to have a class of active. The navigation is in header.php and currently looks like this:

                  <nav>
                      <ul>
                        <li class="active"> <a href="/">Home</a> </li>
                        <li> <a href="#">Apps</a> </li>
                        <li> <a href="#">Forums</a> </li>
                      </ul>
                    </nav>
                  

                  首先,我不知道 JS(jQuery) 是否会更好,或者 PHP 是否会更好.如果它有效,两者都无关紧要.

                  First, I have no idea if JS(jQuery) would be better, or if PHP was to be better. Both wouldn't matter if it works.

                  另外,我对 PHP 有点陌生,正在努力学习.

                  Also I am a bit new with PHP and trying to learn.

                  最简单(希望)使用的方法是什么?所以我不必为了提供导航而更改很多代码 class="active"

                  What would be the easiest (hopefully) method to use? So I don't have to change a lot of code just to give a nav class="active"

                  推荐答案

                  假设您有一个 $page 变量(其中包含您当前所在页面的名称):

                  Asumming you have a $page variable (which contains the name of the page you are currently on):

                    <nav>
                      <ul>
                        <li class="<?php echo ($page == "home" ? "active" : "")?>"> <a href="/">Home</a> </li>
                        <li class="<?php echo ($page == "apps" ? "active" : "")?>"> <a href="#">Apps</a> </li>
                        <li class="<?php echo ($page == "forums" ? "active" : "")?>"> <a href="#">Forums</a> </li>
                      </ul>
                    </nav>
                  

                  这篇关于PHP使用包含在页面上设置活动链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  <tfoot id='bm9Vg'></tfoot>

                        <bdo id='bm9Vg'></bdo><ul id='bm9Vg'></ul>

                            <tbody id='bm9Vg'></tbody>

                            <i id='bm9Vg'><tr id='bm9Vg'><dt id='bm9Vg'><q id='bm9Vg'><span id='bm9Vg'><b id='bm9Vg'><form id='bm9Vg'><ins id='bm9Vg'></ins><ul id='bm9Vg'></ul><sub id='bm9Vg'></sub></form><legend id='bm9Vg'></legend><bdo id='bm9Vg'><pre id='bm9Vg'><center id='bm9Vg'></center></pre></bdo></b><th id='bm9Vg'></th></span></q></dt></tr></i><div id='bm9Vg'><tfoot id='bm9Vg'></tfoot><dl id='bm9Vg'><fieldset id='bm9Vg'></fieldset></dl></div>
                          1. <legend id='bm9Vg'><style id='bm9Vg'><dir id='bm9Vg'><q id='bm9Vg'></q></dir></style></legend>
                          2. <small id='bm9Vg'></small><noframes id='bm9Vg'>