example.psp

来自「mini http server,可以集成嵌入到程序中,实现简单的web功能」· PSP 代码 · 共 37 行

PSP
37
字号
#!/usr/local/psp
<%
use Pi3;

sub pspLoad {
   $piobj = shift;
   $counter = 0;
   # This line will go to the console.
   print "Counter initialized with $counter.\n";
   return 0;
}

sub pspSetResponse {
   $counter++;
   return 0;
}
%><%@ page parsedLength="true" %>
<html><body background="/icons/Pi3Tile.gif" bgcolor="#FFFFFF">
<table width="100%"><TR>
<td align=LEFT valign=CENTER><h1>Perl Server Pages</h1></td>
<td align=CENTER valign=CENTER><img src="/icons/Pi3Web_earth2.gif" alt="Pi3Web"></td>
</tr></table>
<hr>
<h3>General usage of PSP</h3>
<p><b>My filename is: </b><%= $pspRequest{"Path"}; %>
<p><b>I've been invoked: </b><%= $counter; %> times.
<p><b>The local time is: </b><%= localtime(); %>
<p><b>Your browser is: </b><%= $pspRequest{"User-Agent"}; %>
<h3>Invokation of the Pi3Web API's with the Pi3:: package</h3>
<p><b>Your Pi3 platform is: </b><%= Pi3::PIPlatform_getDescription(); %>
<p><b>Your Pi3Web server is: </b><%= Pi3::HTTPCore_getServerStamp(); %>
<p><b>The Pi3Web handler object is: </b><%= $PiObject = Pi3::PIObject_getName($piobj); %>
<hr><form method="GET" action="/printsource.psp/example.psp">
<input type="Submit" value="PSP Source">
</form>
</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?