ASP を使用してコンテンツ内の画像を取得し、コンテンツ内の最初の画像アドレスを取得します。これは主に、CMS にコンテンツ内の画像を保存するために必要です。
次のようにコードをコピーします。
'======================================
'コンテンツ内のすべての写真を取得します
'======================================
関数 Get_ImgSrc(ByVal t0)
ディム t1、Regs、一致、一致
t1=""
IF Not(IsNull(t0) または Len(t0)=0) then
Regs=New RegExp を設定します
Regs.Pattern="<img[^>]+src=""([^"">]+)""[^>]*>"
Regs.Ignorecase=True
Regs.Global=True
Set Matches=Regs.Execute(t0)
IF Matches.Count>0 then
試合中の各試合について
IF Left(Match.SubMatches(0),7)<>"http://" then
t1=t1&"<option value="""&Match.SubMatches(0)&""">"&Match.SubMatches(0)&"</option>"
終了IF
次
終了IF
終了IF
Get_ImgSrc=t1
一致=なしを設定
Regs=Nothing を設定します
終了機能
'======================================
'コンテンツ内の最初の画像を取得します
'======================================
関数 Frist_Pic(ByVal t0)
Frist_Pic=""
薄暗いレジスター、マッチ
Regs=New RegExp を設定します
Regs.Ignorecase=True
Regs.Global=True
Regs.Pattern="<img[^>]+src=""([^"">]+)""[^>]*>"
Set Matches=Regs.Execute(t0)
IF Regs.test(t0) 次に
Frist_Pic=一致(0).サブ一致(0)
終了IF
一致=なしを設定
Regs=Nothing を設定します
終了機能