【发布时间】:2014-12-08 03:26:36
【问题描述】:
我有少量图像文件和文本文件。它们具有相同的文件名和不同的扩展名。我需要读取图像文件,并且对于每个图像,我需要从相应的文本文件中读取一些(工具顶部)文本。问题是在“foreach(glob(“inserts/*.png”)”循环中打开的文件失败。我已经输出了文件名,fopen 工作正常。我想可能是你无法同时打开两个文件PHP,但我在谷歌上一无所获
foreach( glob("inserts/*.png" ) as $filename ) {
$path="public/xml/iweb/".$filename;
$insertpath=substr($filename, 0, -3)."txt";
$myfile = fopen($insertpath, "r");
$rec=fread($myfile,filesize($insertpath));
fclose($myfile);
$name=getInnerSubstring($rec,"-");
$HTML5.="<img class='insertimage' src='".$path."' title='".$name."' onclick='insertcomponent(\"".$insertpath."\")'>";
}
我希望有一天我知道的足够多,可以回答问题,而不仅仅是问问题。 :(
【问题讨论】: