2013-05-22 60 views
0

我在wordpress中有一个很奇怪的问题。preg_match仅适用于字符串

我得到一个帖子内容作为一个变量,我做了变量preg_match没有结果。然后,当使用变量字符串而不是变量本身时,一切都很完美。这让我疯狂,任何人都可以帮助我吗?

// This doesn't work, I checked a thousand times and inside the $content variable 
// is the same string as I use below 
$content = the_content(); 
preg_match('/<iframe.*src=\\"(.*)\\".*><\\/iframe>/is', $content, $matches); 
return $matches; 

// This works perfect? 
$content = the_content(); 
preg_match('/<iframe.*src=\\"(.*)\\".*><\\/iframe>/is', "this is a string containing <iframe ...", $matches); 
return $matches; 

回答