<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >virtual</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="Apache 特有函数" HREF="ref.apache.html"><LINK REL="PREVIOUS" TITLE="getallheaders" HREF="function.getallheaders.html"><LINK REL="NEXT" TITLE="APC 可选 PHP 缓存" HREF="ref.apc.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.getallheaders.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="ref.apc.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.virtual" ></A >virtual</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN8894" ></A ><P > (PHP 3, PHP 4, PHP 5)</P >virtual -- Perform an Apache sub-request</DIV ><DIV CLASS="refsect1" ><A NAME="AEN8897" ></A ><H2 >说明</H2 >bool <B CLASS="methodname" >virtual</B > ( string filename )<BR ></BR ><P > <B CLASS="function" >virtual()</B > is an Apache-specific function which is similar to <TT CLASS="literal" ><!--#include virtual...--></TT > in mod_include. It performs an Apache sub-request. It is useful for including CGI scripts or .shtml files, or anything else that you would parse through Apache. Note that for a CGI script, the script must generate valid CGI headers. At the minimum that means it must generate a Content-type header. </P ><P > To run the sub-request, all buffers are terminated and flushed to the browser, pending headers are sent too. </P ><P >此函数仅在 PHP 作为 Apache 模块安装时才可使用。</P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN8910" ></A ><H2 >参数</H2 ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><CODE CLASS="parameter" >filename</CODE ></DT ><DD ><P > The file that the virtual command will be performed on. </P ></DD ></DL ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN8919" ></A ><H2 >返回值</H2 ><P > Performs the virtual command on success, or returns <TT CLASS="constant" ><B >FALSE</B ></TT > on failure. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN8923" ></A ><H2 >更新日志</H2 ><P > <DIV CLASS="informaltable" ><P ></P ><A NAME="AEN8926" ></A ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >版本</TH ><TH >说明</TH ></TR ></THEAD ><TBODY ><TR ><TD >4.0.6</TD ><TD > This function may be used on PHP files. However, it is typically better to use <A HREF="function.include.html" ><B CLASS="function" >include()</B ></A > or <A HREF="function.require.html" ><B CLASS="function" >require()</B ></A > for PHP files. </TD ></TR ></TBODY ></TABLE ><P ></P ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN8938" ></A ><H2 >注释</H2 ><DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >警告</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P > The query string can be passed to the included file but <CODE CLASS="varname" >$_GET</CODE > is copied from the parent script and only <CODE CLASS="varname" >$_SERVER['QUERY_STRING']</CODE > is filled with the passed query string. The query string may only be passed when using Apache 2. The requested file will not be listed in the Apache access log. </P ></TD ></TR ></TABLE ></DIV ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B > Environment variables set in the requested file are not visible to the calling script. </P ></BLOCKQUOTE ></DIV ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B >自 PHP 4.3.3 起也可以在 Netscape/iPlanet/SunONE 服务器的 <A HREF="ref.nsapi.html" >NSAPI server module</A > 中使用本函数。</P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.getallheaders.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="ref.apc.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >getallheaders</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.apache.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >APC 可选 PHP 缓存</TD ></TR ></TABLE ></DIV ></BODY ></HTML >