// 提取第一個標簽中的 URL
function extractFirstImgUrl($text) {
$pattern = '/\[img\](.*?)\[\/img\]/i'; // 匹配中的內(nèi)容
if (preg_match($pattern, $text, $match)) {
return $match[1]; // 返回第一個匹配的 URL
}
return null; // 如果沒有匹配到 URL,返回 null
}
$firstImageUrl = extractFirstImgUrl($text);
'image'=>$firstImageUrl
歡迎光臨 Discuz! 官方交流社區(qū) (http://r615.cn/) | Powered by Discuz! X5.0 |