标签:使用 blog struct str int 结束 初始化 没有 echo
1、构造函数
用于在创建对象时初始化对象,总是与new操作符一起使用 function __construct($x, $y){ $this->a = $x; $this->b = $y; }
2、构析函数
在对象声明周期结束时,系统自动执行构析函数,执行释放空间等操作 function __destruct(){ echo("<br>" . “对象被销毁了"); }
2、echo和print的区别
echo - 可以输出一个或多个字符串
print - 只允许输出一个字符串,返回值总为 1
echo输出的速度比print快,echo没有返回值,print有返回值1
两个函数中都可以添加HTML元素
echo输出一个字符串
echo("a" . " " . “string”);
echo("a" . "<br>" . "string");
echo输出多个字符串
echo "a", "--", “string";
标签:使用 blog struct str int 结束 初始化 没有 echo
原文地址:http://www.cnblogs.com/jiaoxuanwen/p/6662103.html