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

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

问题描述

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

以下代码在每个页面上指定公司徽标:

如您所见,a 标签的 href only 包含一个正斜杠 /小路.

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

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

我以前从未见过这样做过,而且我似乎找不到任何有关它的文档.感谢您提供的任何信息.

解决方案

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

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

<块引用>

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

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

通过:http://www.linfo.org/forward_slash.html

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.

The following code designates the company logo on every page:

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

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

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.

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

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.

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

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

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