Home > Backend Development > PHP Tutorial > Application of SSI in PHP program_PHP tutorial

Application of SSI in PHP program_PHP tutorial

WBOY
Release: 2016-07-13 10:19:24
Original
810 people have browsed it

Application of SSI in php program

1. What is SSI

Server Side Include: Server Side Include is a server-based web page production technology similar to ASP. You can use Server-Side Include (SSI) directives to include text, graphics, or application information into a web page before the content is sent to the browser. For example, you can use SSI to include a time/date stamp, a copyright notice, or a form for customers to fill out and return. Using include files is an easy way to include text or graphics that appear repeatedly in multiple files. Instead of typing content into all files, just put the content into one include file. An include file is called with a very simple statement, which instructs the web server to insert the content into the appropriate web page. And, when you use include files, all changes to the content only need to be done in one place.

2. What are the commands of SSI

[1] Display server-side environment variables
[2] Insert text content directly into the document
[3] Display WEB document related information (such as file creation date/size, etc.)
[4] Directly execute various programs on the server (such as CGI or other executable programs)
[5] Set SSI information display format ; (such as file creation date/size display method) Advanced SSI ; variables can be set using if conditional statements.

3. APACHE configuration SSI

Apache does not support SSI by default and we need to change httpd.conf to configure it. Here I take Apache 2.0.x on the windows platform as an example: open the httpd.conf file in the conf directory and modify the place

[1] Take out the previous comment

LoadModule include_module modules/mod_include.so

[2] Modify Directory

will

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

Copy after login
was changed to

<Directory />
    Options Indexes FollowSymLinks Includes
    AllowOverride None
</Directory>
Copy after login
[3] Remove the previous comment and make changes

will

#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
Copy after login
was changed to

AddType text/html .shtml .html
AddOutputFilter INCLUDES .shtml .html
Copy after login
3. Source code of index.html

<!DOCTYPE html>
<html>
<head>
<title>测试SSI</title>
</head>
<body >

<div>  
<!-- 登陆前显示登录界面,登陆后显示用户名等基本信息 --> 

 <!--#include file="index.php" -->  
</div> 

</body>
</html>
Copy after login

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/875470.htmlTechArticleApplication of SSI in PHP programs 1. What is SSI? Server-side embedding: Server Side Include is a kind of ASP server-based web page production technology. Before sending content to the browser,...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template