2015-11-19 21 views
0

我正在尋找一個圖像(通過短代碼[圖片] ... [/圖像]在我的WordPress的帖子設置爲特色圖像當我使用的代碼插件汽車保存遠程圖片,我想這會工作,但事實並非如此。我沒有得到Preg_match_all

誰能幫幫我嗎?謝謝!

if(preg_match_all('/.image./(.*?)/..image./', $post->post_content, $matches)){ 
    $first_image = $matches [1] [0]; 

回答

0

嘗試以下(不知道你的簡碼實際上是如何看起來像)

if(preg_match_all('/\[image\](.*?)\[\/image\]/', $post->post_content, $matches)){ 
+0

謝謝,這個工作。但是,我的預定im當我試圖保存遠程圖像時,超過500個帖子的端口超時。看起來像這不是問題:)。 – MajesteitBart