-
在一个类的内部,要调用一个已经定义的静态方法,那么就要用 self::方法名() 在一个类之外,要调用一个类内定义的静态方法,那么就要用 类名::方法名() 在一个子类中,要调用父类内定义的静态方法,那么就要用 parent::方法名() 你明白了吗? 2015-06-24查看全部
-
/$this->speed获取 $speed属性 //parent::speedUp()执行父类的speedUp()方法 $this ->speed = parent::speedUp()+50;查看全部
-
这里的->就相当于其他语言里的“.”;比如$this->name就相当于$this.name一样;就是car类的属性,以及方法的调用,查看全部
-
g g查看全部
-
$img=imagecreatetruecolor(100, 100);//建立长、宽100图像(默认为黑色) $red=imagecolorallocate($img, 0xFF, 0x00, 0x00);//(建立的图像,颜色,颜色,颜色)用来匹配图型颜色 imagefill($img, 0, 0, $red);//imagefill(建立图像,x,y,填充的颜色) x=0,y=0表示坐标 imagepng($img);//imagepng(),以 PNG 格式将图像输出到浏览器或文件,可以改变格式 imagedestroy($img);//imagedestroy()销毁图片查看全部
-
关闭mysql连接 mysql_close(); //数据库操作完后php虽会自动关闭,但为了提高性能可手动关闭 ========================================== $link = mysql_connect($host, $user, $pwd); mysql_close($link); //关闭指定的数据库查看全部
-
受保护的属性与私有属性不允许外部调用,在类的成员方法内部是可以调用的。 class Car{ private $price = '1000'; public function getPrice() { return $this->price; //内部访问私有属性 } }查看全部
-
is_file 判断是不是文件 is_dir 判断是不是目录 file_exists 判断文件或者目录是否存在 is_writeable 判断文件是否可以写入 is_readable 判断文件是否可以读取 file_get_contents 可以把文件读取到字符串内 file_put_contents 可以向文件内写入字符串查看全部
-
我爱你,中国查看全部
-
小呀小苹果查看全部
-
1.构造函数: __construct(); 2.析构函数: __destruct();查看全部
-
<?php //设置默认时区是中国 date_default_timezone_set("Asia/Shanghai"); //返回2014-05-01 12:00:01的格林威治标准时间 $begin_time = '2014-08-11 10:00:00'; $end_time = '2014-08-18 10:00:00'; $now_time = time(); if ( $now_time >= strtotime( $begin_time ) && $now_time < strtotime( $end_time ) ) { echo 'beginning'; }查看全部
-
析构函数指当“某个对象”的所有引用被删除,或者 对象 被"显式的销毁时"执行析构函数,_destruct();查看全部
-
<?php class Car { public $speed = 0; //汽车的起始速度是0 public function speedUp() { $this->speed += 10; return $this->speed; } } //定义继承于Car的Truck类 class Truck extends Car { public function speedUp() { $this->speed = parent::speedUp() + 50; } } $car = new Truck(); $car->speedUp(); echo $car->speed;查看全部
-
$name参数是要调用的方法名称。$args参数是一个枚举数组,包含着要传递给方法$name的参数。 var_dump($name,$arg);// 查看变量具体内容查看全部
举报
0/150
提交
取消