我的问题与这个字符串有关:Mage::helper('catalog/image')->init($product, 'image', $image->getFile())->resize(265)
我试图找到一种方法来找到这个字符串。但是...在字符串中是:$product、image 和 265 变量。所以我需要找到像这样的字符串:
Mage::helper('catalog/image')->init($product, 'image', $image->getFile())->resize(265)
Mage::helper('catalog/image')->init($product, 'thumb', $image->getFile())->resize(75)
Mage::helper('catalog/image')->init($image, 'mini', $image->getFile())->resize(25)
等......
现在我有这个,但它只是在文件中搜索Mage::helper('catalog
function listFolderFiles($dir){
$ffs = scandir($dir);
foreach($ffs as $ff){
if($ff != '.' && $ff != '..'){
if(is_dir($dir.'/'.$ff)) listFolderFiles($dir.'/'.$ff);
if(strpos($ff, '.phtml')!==false){
$contents = file_get_contents($dir.'/'.$ff);
$pattern = preg_quote("Mage::helper('catalog", "/");
$pattern = "/^.*$pattern.*\$/m";
if(preg_match_all($pattern, $contents, $matches)){
echo "Found matches in: ".$dir.'/'.$ff."\n";
}
else{
echo "No matches found in: ".$dir.'/'.$ff."\n";
}
}
}
}
}
listFolderFiles('../app/design');