超链接谁的路径只是正斜杠(/) [英] hyperlink who's path is only a forward slash (/)

查看:203
本文介绍了超链接谁的路径只是正斜杠(/)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被要求对朋友的公司网站进行一些更改。它在每个页面上使用一个PHP插入文件作为标题,这很有用,因为导航等在每个页面上都是相同的。

I have been asked to make some changes to a friend's company website. It uses a PHP insert file for the header on each page, which is useful as the navigation etc is the same on every page.

以下代码指定每页上的公司徽标:

<div id="logo"> 
    <a href="/"></a> 
</div>

如你所见, href a 标记包含正斜杠 / 作为路径。

As you can see, the href of the a tag contains only a forward slash / as it's path.

链接正常,并连接到 index.php 页面。

The link is working fine, and connects to the index.php page.

我想知道它是怎么做到的?看到域的默认页面是由服务器配置文件控制的,这是一个链接到指定默认页面的快捷方式吗?

I'm wondering how it is doing this? Seeing as the default page for the domain is controlled by the server config file, is this a shortcut to link to whatever the default page is designated as?

我从来没有看到这件事以前做过,我似乎无法找到任何有关它的文件。感谢您提供的任何信息。

I've never seen this done before, and I can't seem to find any documentation concerning it. I appreciate any information you can provide.

推荐答案

该链接将您带到公共根目录,然后默认文件启动。

That link brings you to the public root, and then the default file kicks in.

它是绝对路径的相对等价物,例如 http://stackoverflow.com/

It's the relative equivalent of an absolute path, such as http://stackoverflow.com/


在Linux和其他类Unix操作系统中,正斜杠用于表示根目录,该目录位于顶部目录层次结构,包含系统上的所有其他目录和文件。因此,每个绝对路径(相对于根目录的文件系统对象(例如,文件或目录)的地址)以正斜杠开头。

In Linux and other Unix-like operating systems, a forward slash is used to represent the root directory, which is the directory that is at the top of the directory hierarchy and that contains all other directories and files on the system. Thus every absolute path, which is the address of a filesystem object (e.g., file or directory) relative to the root directory, begins with a forward slash.

正斜杠是也用于URL(通用资源定位器)来分隔目录和文件,因为URL基于UNIX目录结构。与UNIX使用的主要区别在于它们以方案(例如,http或ftp)开头,而不是以正斜杠表示的根目录,并且该方案直接遵循冒号的序列和两个连续的正斜杠。表示URL的目录和文件部分的开头。

Forward slashes are also used in URLs (universal resource locators) to separate directories and files, because URLs are based on the UNIX directory structure. A major difference from the UNIX usage is that they begin with a scheme (e.g., http or ftp) rather than a root directory represented by a forward slash and that the scheme is followed directly by the sequence of a colon and two consecutive forward slashes to indicate the start of the directories and file portion of the URL.

via: http://www.linfo.org/forward_slash.html

这篇关于超链接谁的路径只是正斜杠(/)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆