<?php
$str1 = 'dfdfd_ui';
$str2 = 'dfasdfasdf';
function test($str){
preg_match("/.*(\_ui)$/",$str, $matches);
$res = isset($matches[1])&&$matches[1]!=''?'error':'success';
return $res;
}
echo (test($str1));
echo "<br/>";
echo (test($str2));
温馨提示:内容为网友见解,仅供参考