2017-09-05 137 views
1
// THIS WORKS ('contact' is the folder we're in) 
<link rel="stylesheet" type="text/css" href="../contact/local.css"> 

// THESE DO NOT WORK (they point to a 'local.css' in the root directory) 
<link rel="stylesheet" type="text/css" href="./local.css"> 
<link rel="stylesheet" type="text/css" href="local.css"> 

这只是'localhost'的一个问题。它在我使用的Web服务器上工作得非常好,但是如果我可以使用'./'进行测试,那将会很不错。从HTML链接到根目录而不是相同的文件夹? (LocalHost)

我正在使用PhpstormPHP内置Web服务器

回答

2

这是一个用于PHP内置Web服务器的known issue。 目前,网络服务器处理路径时不会将/作为文件追踪,即使它是目录。

要解决此问题,请确保您的网址中有正斜杠。

例如而不是http://localhost/folder,使用http://localhost/folder/

+0

这是一个奇怪的修复,但它现在完美的作品......非常感谢。 –

相关问题