gpt4 book ai didi

directory - xampp 包括不工作

转载 作者:行者123 更新时间:2023-12-03 08:12:56 26 4
gpt4 key购买 nike

首先,我如何知道我的 html 文件是否在 Xampp 的本地主机上运行?是否有关于如何管理文件/目录并使其全部在 htdocs 下工作的教程?是否有关于如何设置 include 的好教程?

我想在我的 html 中使用 Xampp 中的“包含”。我可以同时使用 html 包含和 php 包含吗?我必须放shtml吗?我可以使用 shtml、html、htm 和 php 包含吗?它们是否必须位于 htdocs 下的子目录的 includes 目录中?我可以在其他一些子目录中引用包含吗?我的网站将有 100 多个页面,我正在尝试用不同的版本进行“实验”,直到我满意为止。所以,我有各种下拉菜单的子目录。不幸的是,我似乎无法在 xampp 中使用它。无法显示 Vista Buttons 中的 javascript 菜单,现在我将站点的主目录移动到了 htdocs 目录。

最佳答案

由于 XAMPP 使用 Apache,您需要将其配置为允许 SSI

To permit SSI on your server, you must have the following directive either in your httpd.conf file, or in a .htaccess file:

Options +Includes

This tells Apache that you want to permit files to be parsed for SSI directives. Note that most configurations contain multiple Options directives that can override each other. You will probably need to apply the Options to the specific directory where you want SSI enabled in order to assure that it gets evaluated last.

Not just any file is parsed for SSI directives. You have to tell Apache which files should be parsed. There are two ways to do this. You can tell Apache to parse any file with a particular file extension, such as .shtml, with the following directives:

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

One disadvantage to this approach is that if you wanted to add SSI directives to an existing page, you would have to change the name of that page, and all links to that page, in order to give it a .shtml extension, so that those directives would be executed.

The other method is to use the XBitHack directive:

XBitHack on

XBitHack tells Apache to parse files for SSI directives if they have the execute bit set. So, to add SSI directives to an existing page, rather than having to change the file name, you would just need to make the file executable using chmod.

chmod +x pagename.html

根据 Apache Tutorial: Introduction to Server Side Includes

关于directory - xampp 包括不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/312674/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com