if(file_exists($filename)){
$content=file_get_contents($filename);
echo $content;
}
$content=file_get_contents($filename);
echo $content;
}
2015-04-16
<?php $arr = array("0")?>;
<?php $arr0 = $arr["0"]?>;
<?php print_r($arr0);//结果为0?>;
<?php $arr0 = $arr["0"]?>;
<?php print_r($arr0);//结果为0?>;
2015-04-15
分隔符后面可以使用模式修饰符,模式修饰符包括:i, m, s, x等,例如使用i修饰符可以忽略大小写匹配:
$p = '/bbc/i';
$p = '/bbc/i';
2015-04-15
<?php
class Car {
public static $speed = 0;
//增加speedUp方法,使speed加10
public function speedUp(){
return self::$speed += 10;
}
}
// $car = new Car();
// $car->speedUp();
// echo $car->speed;
echo Car::speedUp();
class Car {
public static $speed = 0;
//增加speedUp方法,使speed加10
public function speedUp(){
return self::$speed += 10;
}
}
// $car = new Car();
// $car->speedUp();
// echo $car->speed;
echo Car::speedUp();
2015-04-15
<?php
class Car{
//在这里定义一个共有属性name
public static $name="汽车";
}
$car = new Car();
//在这里输出$car对象的name属性
//$car::$name="火车";
echo $car::$name;
class Car{
//在这里定义一个共有属性name
public static $name="汽车";
}
$car = new Car();
//在这里输出$car对象的name属性
//$car::$name="火车";
echo $car::$name;
2015-04-15