简体   繁体   English

使用 href 链接到本地主机文件夹之外的路径

[英]link to path outside of localhost folder using href

Problem:问题:

localhost folder is: D:\my_files\project\public本地主机文件夹是:D:\my_files\project\public

Web Server: Apache HTTP Server Web 服务器:Apache HTTP 服务器

so when I type http://localhost, it goes to D:\my_files\project\public所以当我输入 http://localhost 时,它会转到 D:\my_files\project\public

Structure:结构:

/my_files/project/public/index.php /my_files/project/public/index.php

/my_files/project/src/tech.php /my_files/project/src/tech.php

What I want:我想要的是:

<a href="/../src/tech/tech.php">Tech</a> <a href="/../src/tech/tech.php">技术</a>

When clicking the link above it should take me to out of localhost folder inside src folder.单击上面的链接时,它应该带我离开 src 文件夹内的 localhost 文件夹。

You can not access your folder like this since it is not in the Localhost folder.您无法像这样访问您的文件夹,因为它不在 Localhost 文件夹中。 You have two solutions你有两个解决方案

  1. Change Localhost default folder to the parent folder:将 Localhost 默认文件夹更改为父文件夹:

myfiles/project我的文件/项目

  1. Copy you test.php file to your current localhost folder, with all his dependiencies将您的 test.php 文件及其所有依赖项复制到您当前的本地主机文件夹

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM