📄 mod_define.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><!--%hypertext --><!-- mod_define.html --><!-- Documentation for the mod_define Apache module --><HTML><HEAD><TITLE>Apache module mod_define</TITLE></HEAD><!-- Background white, links blue (unvisited), navy (visited), red (active) --><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#000080" ALINK="#FF0000"><BLOCKQUOTE><!-- page indentation --><!--#include virtual="header.html" --><BR><H1 ALIGN="CENTER">Module mod_define</H1><H2 ALIGN="CENTER">Variable Definition For Arbitrary Directives</H2>This module is contained in the <CODE>mod_define.c</CODE> file. It providesthe definition variables for arbitrary directives, i.e. variables which can beexpanded on any(!) directive line. It needs Extended API (EAPI). It is notcompiled into the server by default. To use <CODE>mod_define</CODE> you haveto enable the following line in the server build <CODE>Configuration</CODE>file:<P><PRE> AddModule modules/extra/mod_define.o</PRE><P><HR NOSHADE SIZE=1><H3><A NAME="Define">Define</A></H3><A HREF="directive-dict.html#Syntax" REL="Help"><STRONG>Syntax:</STRONG></A> <CODE>Define</CODE> <EM>variable</EM> <EM>value</EM><BR><A HREF="directive-dict.html#Default" REL="Help"><STRONG>Default:</STRONG></A> <EM>none</EM><BR><A HREF="directive-dict.html#Context" REL="Help"><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR><A HREF="directive-dict.html#Override" REL="Help"><STRONG>Override:</STRONG></A> none<BR><A HREF="directive-dict.html#Status" REL="Help"><STRONG>Status:</STRONG></A> Extension<BR><A HREF="directive-dict.html#Module" REL="Help"><STRONG>Module:</STRONG></A> mod_define.c<BR><A HREF="directive-dict.html#Compatibility" REL="Help"><STRONG>Compatibility:</STRONG></A> Apache+EAPI<BR><P>The <CODE>Define</CODE> directive defines a variable which later can beexpanded with the unsafe but short construct``<CODE>$</CODE><EM>variable</EM>'' or the safe but longer construct``<CODE>${</CODE><EM>variable</EM><CODE>}</CODE>'' on any configuration line.Do not intermix this with the third-party module <CODE>mod_macro</CODE>. The<CODE>mod_define</CODE> module doesn't provide a general macro mechanism,although one can consider variable substitutions as a special form of macros.Because the value of to which ``<CODE>$</CODE><EM>variable</EM>'' expands hasto fit into one line. When you need macros which can span more lines, you'veto use <CODE>mod_macro</CODE>. OTOH <CODE>mod_macro</CODE> cannot be used toexpand a variable/macro on an arbitrary directive line. So, the typical usecase of <CODE>mod_define</CODE> is to make strings <EM>variable</EM> (and thisway easily changeable at one location) and not to <EM>bundle</EM> thingstogether (as it's the typical use case for macros).<P>The syntax of the expansion construct (``<CODE>${</CODE><EM>variable</EM><CODE>}</CODE>'') follows the Perl and Shellsyntax, but can be changed via the <CODE>Define</CODE> directive, too. Fourinternal variables can be used for this. The default is:<BLOCKQUOTE><PRE>Define mod_define::escape "\\"Define mod_define::dollar "$"Define mod_define::open "{"Define mod_define::close "}"</PRE></BLOCKQUOTE><P>When you need to escape some of the expansion constructs you place themod_define::escape character in front of it. The default is the backslash asin Perl or the Shell.<P><STRONG>Example:</STRONG><BLOCKQUOTE><PRE>Define master "Joe Average <joe@average.dom>"Define docroot /usr/local/apache/htdocsDefine hostname fooDefine domainname bar.domDefine portnumber 80 :<VirtualHost $hostname.$domainname:$portnumber>SetEnv SERVER_MASTER "$master"ServerName $hostname.$domainnameServerAlias $hostnamePort $portnumberDocumentRoot $docroot<Directory $docroot> :<Directory></PRE></BLOCKQUOTE><!--#include virtual="footer.html" --></BLOCKQUOTE><!-- page indentation --></BODY></HTML><!--/%hypertext -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -