NetBeans PHP 运行配置:如何省略 doc-root 文件夹?

发布于 2024-08-26 15:52:31 字数 371 浏览 3 评论 0原文

所以我在 PHP 中有这个项目,其中在 wwwroot(或 doc-root)文件夹旁边而不是在 wwwroot 文件夹下有一些包含文件。然而我需要运行/调试这个项目。在项目属性中,我可以选择一个索引文件 (index.php),但它位于 doc-root 文件夹下,因此项目 URL 使 http://myprojectmachine/doc-root/index.php 而不是 ..://myprojectmachine/index.php。手动输入索引文件不起作用,因为 NetBeans 指出未找到该文件。我怎样才能以优雅的方式克服这个问题?

So I have this project in PHP where I have some include files next to the wwwroot (or doc-root) folder instead of under the wwwroot folder. I need however to run/debug this project. in the project properties I can select a index file (index.php) but it's under the doc-root folder, so the Project URL makes http://myprojectmachine/doc-root/index.php instead of ..://myprojectmachine/index.php. Manually typing in the index file doesn't work as NetBeans states the file isn't found. How can I overcome this in an elegant way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

请叫√我孤独 2024-09-02 15:52:31

我昨天也遇到了同样的问题。您可以通过右键单击项目、选择“属性”并单击“源”面板中“Web 根”旁边的“浏览”按钮来选择正确的文档根。

I just had the same problem yesterday. You can select the correct document root by right-clicking on your project, selecting Properties and clicking the Browse button next to "Web root" in the Sources panel.

烟火散人牵绊 2024-09-02 15:52:31

你可以在创建项目时设置项目URL,如果你想到的话,这是最好的时机。它是页面底部的选项,您可以在其中选择代码的目录。

不过,由于您已经创建了它,因此您可以在项目属性中轻松更改它。如果您在本地计算机上执行此操作,我不能 100% 确定这是否有效;我现在打开的唯一基于 Web 的项目,我正在 NetBeans 中通过 SFTP 处理,但是将设置更改为本地 Web 服务器,它显示相同的选项:

  1. Projects 窗格中,右-单击该项目,然后选择 Properties
  2. 转到窗口左侧的 Run Configuration
  3. 您应该会看到 Project URL 作为第三个选项,在这里您可以设置项目的根 URL。所以你只需拥有 http://myprojectmachine/

you can set the project URL when you create the project, which is the best time to do it if you think of it. It's the bottom option on the page where you choose the directory for the code.

Although, since you've already created it, you can easily change it in the project properties. I'm not 100% sure if this will work if you're doing it on your local machine; the only web-based projects I have open right now I'm working on through SFTP in NetBeans, but changing the settings to local web server, it shows the same option:

  1. In the Projects pane, right-click on the project, and select Properties
  2. Go to Run Configuration in the left-hand side of the window
  3. You should see Project URL as the third option, here you set what you want as the root URL for the project. So you would simply have http://myprojectmachine/
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文