NetBeans PHP 运行配置:如何省略 doc-root 文件夹?
所以我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我昨天也遇到了同样的问题。您可以通过右键单击项目、选择“属性”并单击“源”面板中“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.
你可以在创建项目时设置项目URL,如果你想到的话,这是最好的时机。它是页面底部的选项,您可以在其中选择代码的目录。
不过,由于您已经创建了它,因此您可以在项目属性中轻松更改它。如果您在本地计算机上执行此操作,我不能 100% 确定这是否有效;我现在打开的唯一基于 Web 的项目,我正在 NetBeans 中通过 SFTP 处理,但是将设置更改为本地 Web 服务器,它显示相同的选项:
Projects
窗格中,右-单击该项目,然后选择Properties
Run Configuration
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:
Projects
pane, right-click on the project, and selectProperties
Run Configuration
in the left-hand side of the windowProject URL
as the third option, here you set what you want as the root URL for the project. So you would simply havehttp://myprojectmachine/