发新话题
打印

help me

help me

程序如下:
<?php
class test
{
var $t1,$t2
  function test ($str1,$str2)
{
   $this->t1 = $str1;
   $this->t2 = $str2;
}
function m_echo()
{
   echo $this->t1;
   echo "<br>";
   echo $this->t2;
}
}
$mutest = new test("hello,world!"."hello,new oriental!");
$mytest->m_echo();

?>

这条程序是什么意思啊??      
如果一个人把失败作为痛苦,那么他永远是失败者;如果一个人把失败作为通向胜利的阶梯,那他就是胜利的主宰者! ------孤星泪

TOP

<?php
class test
{ var $t1,$t2
function test ($str1,$str2) { $this->t1 = $str1; $this->t2 = $str2; }
function m_echo() { echo $this->t1; echo "<br>"; echo $this->t2; } }
$mutest = new test("hello,world!"."hello,new oriental!");
$mytest->m_echo();

?>
是显示
hello,world<br>hellow,new oriental!
哎,不好说..
怎么书上,没介绍吗?
这其实就是 面向对象的 ...
仔细品味吧...      

TOP

面向对象编程,构造一个类,即class      

TOP

发新话题