我只想.html
从下面的字符串中获取字符串后跟扩展名。
这个例子 :
登录.html
forgot_password.html
admin_screen.html
delete_checklist.html
print_preview.html
细绳:
$haystack= "b='rootNodes',c='pageName',d='login',e='type',f='kjhk',g='url',h='login.html',i='children'
,j='forgot password',k='forgot_password.html',l='password recovery',m='password_recovery.html',n='superadmin dashboard',o='superadmin_dashboard.html',p='admin screen',q='admin_screen.html',r='newchecklist
popup',s='admin_screen.html',t='delete checklist',u='delete_checklist.html',v='print preview', w='print_preview.html',x='Checklist - Normal Procedure',y='Checklist___Normal_Procedure.html',
z='normal procedure - insert text'"
我已经尝试过,但结果并不接近。
function strallpos($haystack,$needle,$offset = 0){
$result = array();
for ($i = $offset; $i < strlen($haystack); $i++) {
echo $pos = strpos($haystack, $needle, $i);
if ($pos !== FALSE) {
$offset = $pos;
if ($offset >= $i) {
$i = $offset;
$pos2 = strpos($haystack, '=', $i);
//Here substr find
$result[] = $offset;
}
}
}
return $result;
}