首先,我如何知道我的 html 文件是否在 Xampp 的本地主机上运行?
是否有关于如何管理文件/目录并使其在 htdocs 下工作的教程?
有关于如何设置的好的教程吗?
我想在 Xampp 中将“includes”与我的 html 一起使用。
我可以同时使用 html 包含和 php 包含吗?
我必须放shtml吗?
我可以使用 shtml、html、htm 和 php 包含吗?
它们是否必须位于 htdocs 下的包含目录中?
我可以引用包含在其他子目录中吗?
我的网站将有超过 100 个页面,我正在尝试使用不同的版本进行“实验”,直到我满意为止。 所以,我有各种下拉菜单的子目录。 不幸的是,我似乎无法在 xampp 中使用它。
由于我将站点的主目录移至 htdocs 目录,因此无法从 Vista 按钮显示我的 javascript 菜单。
First off, how do I know if my html file is running on localhost in Xampp?
Is there a tutorial on how to manage files/directories and get that all working under htdocs?
Is there a good tutorial on how to setup includes?
I want to use "includes" in Xampp with my html.
Can I use both html includes AND php includes?
Do I have to put shtml?
Can I use shtml, html, htm, and php includes?
Do they have to be in an includes directory that is a subdirectory right under htdocs?
Can I reference includes in some other subdirectory?
My site will have over 100 pages, and I am trying to do "experiments" with different versions until I am happy. So, I have subdirectories for the various drop down menus. Unfortunately, I don't seem to be able to get this working in xampp.
Having trouble getting my javascript menus from Vista Buttons to show up, now that I moved my main directory for my site to the htdocs directory.
发布评论
评论(5)
由于XAMPP使用Apache,您需要将其配置为允许SSI。
根据 Apache 教程:服务器端包含简介
Since XAMPP uses Apache you need to configure it to permit SSI.
According to Apache Tutorial: Introduction to Server Side Includes
我遇到了同样的问题,但我无法弄清楚我到底需要修改哪些文件以及哪些文件。 因此,要修复它,请按照 XAMPP 本地主机服务器中的以下步骤操作。
转到您的:
搜索:
添加以下两行:
转到Xampp 控制面板并停止会话并再次重新启动。
刷新浏览器中的页面,看看,虚拟包含将开始工作。
I have faced the same issue but I was not able to figure out where exactly I have to modify and which files. So to fix it follow the below steps in XAMPP Localhost server.
Go to your:
Search for:
Add the below two lines:
Go to Xampp Control Panel and stop the session and restart again.
Refresh the page in browser and see, the virtual includes will start working.
要回答您的第一个问题,您可以访问 http://localhost/ 吗? 如果是这样,则 xampp 运行正确,您无需执行任何其他操作。
编辑:如果您想确保一切正常工作,请将 foo.html 放在 /xampp/htdocs 下,然后在浏览器中通过 http://localhost/foo.html. 如果您无法获取此页面,则 xampp 仍然无法正常运行。
在回答你的第二个问题时,无论是在 HTML 中还是在 PHP 中,所有 Include 都是服务器端的。 如果您正确安装了 xampp,那么您可以立即开始使用 PHP 并可以使用 PHP 中的包含函数(请注意,即使页面仅包含 HTML,如果您使用 PHP,它仍然必须具有 .php 扩展名) 。
如果您希望在 .html 页面中使用 SSI,那么此链接可能会提供有关如何在 xampp 中设置和调试 SSI 的一些帮助。
此外,如果您还没有这样做,我建议您在安装了 Firebug 的 Firefox 中工作。 Firebug 将处理您的大部分 JavaScript 调试需求。
最后一点,如果您移动了目录等,我首先要检查的是脚本标记上的 src 属性。
To answer your first question, can you access http://localhost/? If so, then xampp is running correctly and there is nothing more that you need to do.
EDIT: If you want to ensure that things are working correctly, place foo.html under /xampp/htdocs and then access it in a browser at http://localhost/foo.html. If you can't get this page then xampp still isn't running correctly.
In answer to your second question, all Includes whether in the HTML or within PHP are server side. If you have xampp installed correctly, then you can begin working in PHP immediately and can use the include functions within PHP (please note that even if a page only contains HTML, if you're using PHP it must still have a .php extension).
If you would rather use SSI in your .html pages, then this link might provide some help on how to set up and debug SSI in xampp.
Additionally, if you are not already doing so I would recommend that you work in Firefox with Firebug installed. Firebug will handle most of your JavaScript debugging needs.
As a final note, if you've moved directories and the like, the first thing I would check would be the src attributes on your script tags.
我发现要使包含在 XAMPP 中工作,具有包含功能的页面需要具有扩展名“.shtml”,而包含的文件具有“.html”。 大多数现代浏览器不需要 shtml 扩展名,但 XAMPP 似乎需要。
.js 似乎是一样的。
I found out that for includes to work in XAMPP your page with the include function needs to have the extension '.shtml' while the included file has '.html'. Most modern browsers don't require the shtml extension but XAMPP seems to.
.js seems to be the same.
您可能想查看 AMPstart 而不是 xampp-control。 它有一些很好的功能,允许您将站点文件夹放置在 htdocs 之外,而不用乱搞 apache conf 的东西
You might want to look at AMPstart instead of xampp-control. It has some nice ability to allow you to place site-folders outside of htdocs w/o messing around with apache conf stuff