<?php
function func() {
echo 'exists';
}
$name = 'func';
function_exists($name );
{ //判断函数是否存在
$name();
}
function func() {
echo 'exists';
}
$name = 'func';
function_exists($name );
{ //判断函数是否存在
$name();
}
2017-01-21
class Truck extends Car{
public function speedUp(){
return $this->speed+=60;
}
}
你们试一下,我试过了,可以的!
public function speedUp(){
return $this->speed+=60;
}
}
你们试一下,我试过了,可以的!
2017-01-20
echo file_exists($filename)?'文件存在':'文件不存在';
2017-01-20
<?php
$subject = "my email is spark@imooc.com";
//在这里补充代码,实现正则匹配,并输出邮箱地址
$email = '/is ([\w\@\.]+)/';
preg_match($email, $subject, $matches);
print_r($matches[1]);
?>
$subject = "my email is spark@imooc.com";
//在这里补充代码,实现正则匹配,并输出邮箱地址
$email = '/is ([\w\@\.]+)/';
preg_match($email, $subject, $matches);
print_r($matches[1]);
?>
2017-01-18
functio
n getsize($size, $format = 'kb') {
$p = 0;
if ($format == 'kb') {
$p = 0;echo $size."kb<br>=";
} elseif ($format == 'mb') {
$p = 1;echo $size."mb<br>=";
} elseif ($format == 'gb') {
$p = 2;echo $size."gb<br>=";
}
$size = $size*pow(1024,$p);
n getsize($size, $format = 'kb') {
$p = 0;
if ($format == 'kb') {
$p = 0;echo $size."kb<br>=";
} elseif ($format == 'mb') {
$p = 1;echo $size."mb<br>=";
} elseif ($format == 'gb') {
$p = 2;echo $size."gb<br>=";
}
$size = $size*pow(1024,$p);
2017-01-17