无法打开本地服务器上的文件

Unable to open a file on local sever

在浏览器中将 'localhost' 写为 url 时,此位置的 index.html 运行s: **file:///C:/xampp/htdocs/PrepLift/html/index.php**

一般在浏览器中将localhost写成url,index.html文件保存在htdocs 运行s。但就我而言 index.html 保存在其他位置 运行s.

如果我想 运行 一个 index.html 文件保存在 htdocs 中,我应该写成 url?

假设我想 运行 这个文件:///C:/xampp/htdocs/wp_blog/accesspress-lite/index.php 在浏览器上使用 localhost。 (此文件在 htdocs 中保存的其他一些分支文件夹中)。 url 应该写什么?

因为我要运行的目标文件在localhost index.html 运行ning 位置之前的文件夹中。

运行 服务器并在 http 协议上打开...文件协议将不会执行 php 代码

您正在使用 xampp。所以 运行 它并在某处访问它 http://localhost/wp_blog/(如果你的端口不是80比 http://localhost:PORT_NO/wp_blog/ 例如 PORT_NO = 8000 比 http://localhost:8000/wp_blog/

您也可以像这样 运行 默认 php 服务器(如果 php 全球可用): 转到 public 文件夹 -> 打开 cmd -> 输入 "php -S localhost:8000"