<?php $a = "123@abc#456"; $b = (strpos($a,"@")); $c = (strpos($a,"#")); echo substr($a,$b+1,$c-1); ?>
$str = $_SERVER[REQUEST_URI]; $arr = explode("/",$str); $last = $arr[count($arr)-2];
博客列表 >PHP截取两个指定字符中间的字符和截取后两个/之间的字符
<?php $a = "123@abc#456"; $b = (strpos($a,"@")); $c = (strpos($a,"#")); echo substr($a,$b+1,$c-1); ?>
$str = $_SERVER[REQUEST_URI]; $arr = explode("/",$str); $last = $arr[count($arr)-2];