📄 15-5.php3
字号:
<?
/*
** Check a ZIP code
** This script will test a zip code, which
** must be five digits optionally followed by
** a dash and four digits.
*/
//start HTML page
print("<HTML>\n");
print("<HEAD>\n");
print("<TITLE>Figure 15-5</TITLE>\n");
print("</HEAD>\n");
print("<BODY>\n");
/*
** if zip submitted evaluate it
*/
if(isset($zip))
{
if(ereg("^([0-9]{5})(-[0-9]{4})?$", $zip))
{
print("$zip is a valid ZIP code.<BR>\n");
}
else
{
print("$zip is <B>not</B> a valid ZIP code.<BR>\n");
}
}
//start form
print("<FORM ACTION=\"15-5.php3\">\n");
print("<INPUT TYPE=\"text\" NAME=\"zip\">\n");
print("<INPUT TYPE=\"submit\">\n");
print("</FORM>\n");
//close page
print("</BODY>\n");
print("</HTML>\n");
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -