【求助phpmailer类应用】教程文章相关的互联网学习教程文章

velocity第三个应用例子--遍历集合/数组

velocity第三个应用例子--遍历集合/数组//2.Create a Context object VelocityContext context = newVelocityContext(); //3.Add your data objects to this context context.put("list",Arrays.asList("第一个","第二个","第三个","第四个")); //4.Choose a template Template template =Velocity.getTemplate("list.vm"); //5.Merge the template and your data toproduce the output StringWriter sw = new StringWriter(); tem...

velocity第二个应用例子—访问对象

首先创建一个对象,提供构造方法只需初始化一次即可。//2 Create a Context objectVelocityContext context = newVelocityContext();//3 Add you data objcts to this contextcontext.put("person", newPerson(1,"小张",23));//4 Choose a templateTemplate template =Velocity.getTemplate("person.vm");StringWriter sw = new StringWriter();//5 Merge the template and you data toproduce the outputtemplate.merge(context, ...

velocity第四个应用例子---遍历Map集合

velocity第四个应用例子---遍历Map集合//2 Create a Context object VelocityContext context = newVelocityContext(); //3 Add you data objects to this context Map<String,String> map = newHashMap<String,String>(); map.put("key1","value1"); map.put("key2","value2"); map.put("key3","value3"); map.put("key4","value4"); context.put("map", map); //4 Choose a template Template template =Velocity.getTemplate("m...

velocity第五个应用例子---获得当前迭代的索引

velocity第五个应用例子---获得当前迭代的索引#foreach($key in $map.keySet())$velocityCount > $key : $map.get($key)#end$velocityCount获得当前迭代索引velocityCount变量名可以通过directive.foreach.counter.name属性修改,如:directive.foreach.counter.name=index,以后可以通过$index进行访问。迭代的索引默认从1开始,我们可以通过directive.foreach.inital.value=0进行修改。控台输出1> key4 : value42> key3 : value33...

velocity第七个应用例子----在模板中进行赋值

velocity第七个应用例子----在模板中进行赋值//2 Create a Context objectVelocityContext context = newVelocityContext();//3 Add you data object to this contextcontext.put("name", "老毕");//4 Choose a templateTemplate template =Velocity.getTemplate("template7.vm");//5 Merge the template and you data toproduce the outputStringWriter sw = new StringWriter();template.merge(context, sw);sw.flush();System.o...

velocity第8个应用例子----#if#else#end

velocity第8个应用例子----#if#else#end//2 Create a Context objectVelocityContext context = newVelocityContext();//3 Add you data object to this contextcontext.put("condition", false);//4 Choose a templateTemplate template =Velocity.getTemplate("ifelse.vm");//5 Merge the template and you data toproduce the outputStringWriter sw = new StringWriter();template.merge(context, sw);sw.flush();System.out.p...

velocity第9个应用例子---格式化日期

扩展功能,可以写个工具类,然后把工具类放到context中,在模板中可以直接调用工具类的方法默认情况下,日期输出的TueJul 14 16:42:30 CST 2015我们需要写个工具类,对日期进行格式化,把原日期和日期格式化工具类都放入到context中在模板中,调用日期格式化工具类的方法,对日期进行格式化$dateformat.format("yyyy-MM-dd",$date)//2 Create a Context objectVelocityContext context = newVelocityContext();//3 Add you data ob...

velocity第10个应用例子---输出到文件

velocity第10个应用例子---输出到文件//2 Create a Context objectVelocityContext context = newVelocityContext();//3 Add you data object to this contextcontext.put("title", "银联电子");context.put("body", "这是内容"); //4 Choose a templateTemplate template =Velocity.getTemplate("file.vm");//创建文件File saveFile = newFile("G:\\workspace\\zjq\\velocity\\WebRoot\\page\\test.html");//获得它的父类文件,如...

PHPMySQL应用中使用XOR运算加密算法分享

XOR算法原理从加密的主要方法看,换位法过于简单,特别是对于数据量少的情况很容易由密文猜出明文,而替换法不失为一种行之有效的简易算法。从各种替换法运算的特点看,异或运算最适合用于简易加解密运算,这种方法的原理是:当一个数A和另一个数B进行异或运算会生成另一个数C,如果再将C和B进行异或运算则C又会还原为A。相对于其他的简易加密算法,XOR算法的优点如下。(1)算法简单,对于高级语言很容易能实现。(2)速度快,可以在任...

phpmb_substr()函数截取中文字符串应用示例

substr()函数用来截取字符串,但是对于中文字符会出现问题,而mb_substr()和mb_strcut这两个函数可以,用法与substr()相似,只是在函数最后要加入多一个参数,以设定字符串的编码,使用这两个函数需要在php.ini中把php_mbstring.dll打开。<?php header("content-type:text/html; charset=utf-8"); $string = "你好我好大家好"; echo strlen($string).</br>; echo mb_substr($string,0,4,utf-8)....</br>; echo mb_strcut($string,...

PHP中continue语句的应用【图】

一 实例<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>使用continue关键字控制流程</title> <style type="text/css"> <!-- body,td,th { font-size: 12px; } body { margin-left: 10px; margin-top: 10px; ma...

PHP中break语句的应用【图】

一 实例<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>使用break关键字跳出多重循环</title> <style type="text/css"> <!-- body { background-color: #CCFF00; } --> </style></head> <body> <?php while(tr...

解析php中反射的应用

一 反射的使用: <?php class Person{public $name;function __construct($name){$this->name=$name;} } interface Module{function execute(); } class FtpModule implements Module{function setHost($host){print "FtpModule::setHost():$host\n";}function setUser($user){print "FtpModule::setUser():$user\n";}function execute(){//something} } class PersonModule implements Module{function setPerson(Person $person...

php反射应用示例【图】

<?php function custom(){ } class custom{public function index(){}} print_r(get_define_position(custom));/*** /* @param string $name 函数名或者类名* @return array */function get_define_position($name){$info = array();if(class_exists($name)){$ob = new ReflectionClass($name);$info[class_.$name]= array(file=>$ob->getFileName(),line=>$ob->getStartLine());}if(function_exists($name)){$ob = new Re...

PHP的数组应用基础(三)

PHP基础语法中比较重要的,都给发出来了。掌握了这些,其实,我老师说PHP里面,最重要的是数组了,它随处可见,随着编程的增加,我也越来越这么觉得。1.数组的定义数组:就是一组数据的集合,把一系列数据组织起来,形成一个可操作的整体。它包括元素和下标。元素就是数组中可以存储多个值,每个值我们称之为数组的元素;下标就是每个数组的元素有一个相关的索引,可视为资料内容在数组中的识别名称,通常也被称为数组下标或键名。...

PHPMAILER - 相关标签