您的位置:IT教程网首页>网络编程教程>php教程>SSI使用详解(二)

SSI使用详解(二)

5.Flastmod:显示指定文件的最后修改日期,可以结合config 命令的timefmt参数控制输出格式。

$#@60;!--#config timefmt="%A, the %d of %B, in the year %Y" --$#@62;
$#@60;!--#flastmod file="file.html" --$#@62;

这里,我们可以利用flastmod参数显示出一个页面上所有链接页面的更新日期。方法如下:

$#@60;!--#config timefmt=" %B %d, %Y" --$#@62;
$#@60;A HREF="/directory/file.html"$#@62;File$#@60;/A$#@62;
$#@60;!--#flastmod virtual="/directory/file.html" --$#@62;
$#@60;A HREF="/another_directory/another_file.html"$#@62;Another File$#@60;/A$#@62;
$#@60;!--#flastmod virtual="/another_directory/another_file.html" --$#@62;

显示结果为:

File April 19, 2000
Another File January 08, 2000

也许有的读者会认为两个链接就这么复杂,一点也不方便。其实,假如页面上有20个或者更多的链接,而且每个链接都定期更新的话,就可以看出使用flastmod显示修改日期的作用。

6.Exec

Exec命令可以执行CGI脚本或者shell命令。使用方法如下:

Cmd:使用/bin/sh执行指定的字串。假如SSI使用了IncludesNOEXEC选项,则该命令将被屏蔽。

Cgi:可以用来执行CGI脚本。例如,下面这个例子中使用服务端cgi-bin目录下的counter.pl脚本程序在每个页面放置一个计数器:

$#@60;!--#exec cgi="/cgi-bin/counter.pl" --$#@62;

共2页: 上一页 [1] 2 下一页