<?php
class Car {
public static $speed = 10;
public static function __callStatic($name, $args) {
if ($name == 'speedDown') {
self::$speed -= 10;
}
}
//在这里使用重载实现speedDown方法
}
$car = new Car();
$car::speedDown(); //调用不存在的speedDown方法
echo car::$speed;
class Car {
public static $speed = 10;
public static function __callStatic($name, $args) {
if ($name == 'speedDown') {
self::$speed -= 10;
}
}
//在这里使用重载实现speedDown方法
}
$car = new Car();
$car::speedDown(); //调用不存在的speedDown方法
echo car::$speed;
2016-06-17
class Truck extends Car{
public function speedUp(){
$this->speed = parent::speedUp();
$this->speed+=50;
return $this->speed;
}
}
public function speedUp(){
$this->speed = parent::speedUp();
$this->speed+=50;
return $this->speed;
}
}
2016-06-17
file create time ==>filectime()
file modify time ==>filemtime()
file access time ==>fileatime()
file modify time ==>filemtime()
file access time ==>fileatime()
2016-06-16
最新回答 / 188CM森
函数说明:explode(分隔符[可选], 字符串)返回值:函数返回由字符串组成的数组<?php//分隔字符串$str = 'sun-moon-star';//$a = explode('-', $str);//print_r($a) ;print_r(explode('-', $str)) ;?>返回的是数组.. 可以自己查查echo print_r的区别
2016-06-15
大家在吐糟的看不懂的时候其实我想说,其实人一定要有自学能力,直接能听懂的和自己看的半懂然后想办法去解决搞懂的,肯定是后者能够顺带领悟更多的东西,而且对概念的理解更加深刻和形象化。没有自学能力的人以后真的能写程序???
2016-06-14
我完全看得懂。一般类中的函数是不会在这个类实例化的时候直接执行的,但是构造函数就是可以在类在new成对象的时候直接就自动执行一次,这是为了一些特殊的操作设计的。但是如果子类中也有构造函数的话,那么父类中的构造函数是不会自动执行的。如果也需要执行,我觉得应该就是被覆盖了的意思,如果父类中的也要执行的话,就得指定 parent:: _construct().有完全看不懂的人我觉得你可能漏看了什么基础的知识!
2016-06-14
$patterns='/(\w+.)(php|css|js)/';
// $patterns='/\w+\.\w+/';
$replace='<em>${0}</em>';
// $patterns='/\w+\.\w+/';
$replace='<em>${0}</em>';
2016-06-14