|
<br> <html> <BR><head><title>正则表达式</title></head> <BR><body> <BR><a href="./">返回列表</a> <BR><form action="<? echo $PHP_SELF; ?>" method="post"> <BR>请输入MM/DD/YYYY格式的日期: <BR><input type="text" name="date" value="<? echo $date; ?>"> <BR><input type="submit" value="转换为YYYY-MM-DD格式"> <BR></form> <BR><? <BR>if(isset($date)){ <BR> if ( ereg( "([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})", $date, $regs ) ) { <BR> echo $regs[0] . "的转换结果为:" . $regs[3] . "-" . $regs[1] . "-" . $regs[2]; <BR> } else { <BR> echo "$date 的日期格式不对!<br>"; <BR> } <BR>} <BR>?> <BR></body> <BR></html> <br><br> |
|