$str = "Layout15 : This is Testing"如何取出Layout后边的那个15呢?

解决方案 »

  1.   


    //上次有人问过了,不知是不是你。。
    $str = "Layout15 : This is Testing";
    preg_match('/Layout(\d+)/', $str, $matches);
    echo($matches[1]);
      

  2.   

     是我啊,preg_match('/Layout(\d+)/', $str, $matches); 这个不对啊,取1位数可以,2位数不行
      

  3.   


    $selectedLayout = $_POST['ddLayout'];  
    print_r($selectedLayout);   //这句输出 Layout10: AA + BB
    preg_match('/Layout(\d)+/', $selectedLayout, $matches);
    $layout = $matches[1]; 
    echo $layout;   //这句输出 0 , 肯定不对啦,应该是10
      

  4.   

    Layout(\d+),不够仔细呀。