feat: Nas专题帮助中心
This commit is contained in:
@@ -98,3 +98,21 @@ if (!function_exists('thumb')) {
|
||||
return mb_substr($url, 0, $idx, 'utf-8') . '_thumb' . mb_substr($url, $idx, $len - $idx, 'utf-8');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_path_from_img_tag'))
|
||||
{
|
||||
/**
|
||||
* 从img标签中获取图片路径
|
||||
* @param string $img
|
||||
* @return string
|
||||
*/
|
||||
function get_path_from_img_tag(string $img): string
|
||||
{
|
||||
$match = preg_match('/<img[^>]+src=[\'"](.*?)[\'"][^>]+>/i', rawurldecode($img), $matches);
|
||||
if ($match) {
|
||||
return $matches[1];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user