简体   繁体   English

包括:用于单独文件中的基本HTML和Javascript的SSI或PHP

[英]Includes: SSI or PHP for basic HTML and Javascript in separate files

I got my Xampp server running and can run my html in subdirectories now, as well (can't have spaces in the subdirectory names). 我运行了Xampp服务器,并且现在也可以在子目录中运行html(子目录名称中不能有空格)。

SSI Includes or PHP Includes: SSI包括或PHP包括:

Xampp says SSI is deactivated. Xampp说SSI已停用。 Tried uncommenting the lines for includes, but it doesn't change the deactivation. 尝试取消注释include的行,但不会更改停用状态。

How do I activate SSI? 如何激活SSI?

Then, how do I implement either SSI include statements or PHP include statements into my html to call up html files that include html, images, javascript and commands that call other javascript menu files? 然后,如何在我的html中实现SSI包含语句或PHP包含语句来调用包含html,图像,javascript和调用其他javascript菜单文件的命令的html文件?

I don't know if Xampp has a special way of activating SSI or not, but the normal Apache way should work. 我不知道Xampp是否具有激活SSI的特殊方法,但是正常的Apache方法应该可以工作。

The normal way to include files in SSI is 在SSI中包含文件的通常方法是

<!--#include virtual="/something/file.html" --> 

where the url to the file is actually http://www.example.com/something/file.html . 该文件的网址实际上是http://www.example.com/something/file.html

If XAMPP says SSI are disabled by default, you need to edit your server configuration ( not your .HTACCESS file ) to change this. 如果XAMPP表示默认情况下禁用SSI,则需要编辑服务器配置( 而不是.HTACCESS文件 )以更改此设置。 Otherwise, you could try installing a plugin for your server to fix the issue. 否则,您可以尝试为服务器安装插件来解决此问题。

Hope this helps! 希望这可以帮助!

~ Nate. 〜内特。

PHP includes are pretty straightforward. PHP包含的内容非常简单。 Just name your file something.php and do this: 只需将文件命名为something.php并执行以下操作:

<?php include('path/to/file.php'); ?>

The file will be parsed by php so it can contain the standard mix of PHP/HTML tags or whatever other text you'd like. 该文件将由php解析,因此它可以包含PHP / HTML标记或您想要的任何其他文本的标准组合。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM