细绳:
$local = "/c/xampp/htdocs/path/storage/public/*"
如何在字符串上方爆炸并仅获得后面的部分/path
?
像这样
getPublicPart( $local ) // @return string "/storage/public/*"
根据提供的信息,我可以做的最好的
<?php
$absolute = "/c/xampp/htdocs/path/storage/public/*";
function getPublicPart($path){
$x=explode('path',$path);
return $x[1];
}
echo getPublicPart( $absolute ); // @return string "/storage/public/*"
演示:http : //codepad.viper-7.com/EXU7Q5
计划2
删除已知点之前的所有内容:
function getPublicPart($path){
return strstr($path, 'storage');
}
echo getPublicPart( $absolute );
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句