$p = "/<li>(.*)<\/li>/i";
preg_match_all($p, $str, $matches);
print_r($matches[1]);
preg_match_all($p, $str, $matches);
print_r($matches[1]);
2016-02-01
<?php
$subject = "my email is spark@imooc.com";
$pattern='/\s(\w+@\w+.com)/';
preg_match($pattern,$subject,$str);
print_r($str[1]);
$subject = "my email is spark@imooc.com";
$pattern='/\s(\w+@\w+.com)/';
preg_match($pattern,$subject,$str);
print_r($str[1]);
2016-02-01
已采纳回答 / Zery_Chao
因为你的$car->name = '奥迪A6';语句将$car对象的name属性赋值为'奥迪A6',然后echo $car->getName();语句又输出了$car对象的name属性值。
2016-01-31
已采纳回答 / Zery_Chao
你的echo gmdate('Y-m-d H:i:s',strtotime('2014-05-01 12:00:01'));语句中H:i:s部分第一个冒号是全角“:”,应该为半角“:”,第二个和第三个冒号是正确的。
2016-01-31
$str = 'one two';
$str = preg_replace('/\s+/', ' ', $str);
echo $str; // 结果改变为'one two'
$str = preg_replace('/\s+/', ' ', $str);
echo $str; // 结果改变为'one two'
2016-01-30