摘要: Date日期校验器代码:<?phprequire_once 'Zend/Validate/Date.php';function c_date($date){ $validator = new Zend_Validate_Date(); if($validator->isValid($date)){ echo "输入的日期格式:"; echo $date."有效!<p>"; }else{ echo "输入的日期格式:"; echo $date."无效!<p>"; } 阅读全文
posted @ 2013-04-08 15:18 TBHacker 阅读(361) 评论(0) 推荐(0) 编辑
摘要: 通过setMessage自定义错误信息代码:<?phprequire_once 'Zend/Validate/EmailAddress.php';function c_email($email){ $validator = new Zend_Validate_EmailAddress(); $validator->setMessage( "%value%不符合标准的E-mail地址格式" ); if($validator->isValid($email)){ echo "输入的E-mail地址:"; echo $emai 阅读全文
posted @ 2013-04-08 12:05 TBHacker 阅读(383) 评论(0) 推荐(0) 编辑
摘要: while循环语句代码:#include <iostream>#include <conio.h>int main(){ int sum = 0,val = 1; while(val<=10){ sum += val; ++val; } std::cout<<"Sum of 1 to 10 is "<<sum<<std::endl; getch(); return 0;}结果:Sum of 1 to 10 is 55点评:++val 和val=val+1是一样的。for语句代码:#include <io 阅读全文
posted @ 2013-04-08 09:37 TBHacker 阅读(246) 评论(0) 推荐(0) 编辑