function getExt($filename){
$pos = strripos($filename,".");
if(!$pos){
return "扩展名不存在!";
}else {
return substr($filename, $pos + 1);
}
}
$pos = strripos($filename,".");
if(!$pos){
return "扩展名不存在!";
}else {
return substr($filename, $pos + 1);
}
}
2021-01-16
最新回答 / 星随
正则表达式function file1($file_name='text.txt'){ $sss='|\.[\w]+$|'; $file_name=$file_name; $ccc=NULL; if(preg_match($sss,$file_name,$match)){ $bbb=$match[0]; return $bbb; }else{ return $ccc; }echo file1('1');echo "<br&...
2020-06-30
function catchExte($sExtension){
$sStr = strchr($sExtension,'.');
$sResult = substr($sStr, 1);
return $sResult;
}
$sString = '1fdsf23.html'; //输入123.php txt.html等等
$sFunc = catchExte($sString);
var_dump($sFunc);
$sStr = strchr($sExtension,'.');
$sResult = substr($sStr, 1);
return $sResult;
}
$sString = '1fdsf23.html'; //输入123.php txt.html等等
$sFunc = catchExte($sString);
var_dump($sFunc);
2019-04-12
最新回答 / 街长
call_user_func()方法是回调函数,function($username){echo "hello {$username}";}这部分是匿名函数,相当于function A($username){echo "hello".$username;}"king"是要传递的参数,传给$username;相当于是A(‘King’);
2019-03-16
已采纳回答 / _Jack_Han_
把第五行改成 $filearray = str.split($file);array(str.split($file))是一个二维数组,你打印出来看一看就知道了。
2018-12-30