$p = "/(\w+\.\w+)/";
$replace = "<em>$1</em>";
echo preg_replace($p,$replace,$str);
$replace = "<em>$1</em>";
echo preg_replace($p,$replace,$str);
2017-07-29
<?php
$str = "<ul>
<li>item 1</li>
<li>item 2</li>
</ul>";
//在这里补充代码,实现正则匹配所有li中的数据
$p="/<li>[\w\s\d\_\-]+<\/li>/i";
preg_match_all($p, $str, $matches);
print_r($matches[0]);
$str = "<ul>
<li>item 1</li>
<li>item 2</li>
</ul>";
//在这里补充代码,实现正则匹配所有li中的数据
$p="/<li>[\w\s\d\_\-]+<\/li>/i";
preg_match_all($p, $str, $matches);
print_r($matches[0]);
2017-07-29
<?php
$subject = "my email is spark@imooc.com";
$p="/\s[0-9a-zA-Z\_\-]+@\w+\.com/";
preg_match($p,$subject,$matches);
echo trim($matches[0]);
$subject = "my email is spark@imooc.com";
$p="/\s[0-9a-zA-Z\_\-]+@\w+\.com/";
preg_match($p,$subject,$matches);
echo trim($matches[0]);
2017-07-29
public 普通物品,有钱都可以直接买里面允许的所有物品;
private vip商品,如果外人想买,可以借用vip某人的卡,某人::证明可行 买吧
private vip商品,如果外人想买,可以借用vip某人的卡,某人::证明可行 买吧
2017-07-28
懂了,我的理解是当实例化对象时,调用speedDown方法,因为speedDown方法是不存在的,交给__call来处理,然后判断...
class Car {
public $speed = 10;
public function __call($name,$arr){
if($name == "speedDown"){
$this->speed-=10;
}else{
echo "调用方法不存在";}
}}
$car = new Car();
$car->speedown();
class Car {
public $speed = 10;
public function __call($name,$arr){
if($name == "speedDown"){
$this->speed-=10;
}else{
echo "调用方法不存在";}
}}
$car = new Car();
$car->speedown();
2017-07-28
mysql_query("truncate table code1")
很多数据,执行一下会变怎么样?
很多数据,执行一下会变怎么样?
2017-07-27