0
我有一個數組,我知道,它的價值將是JPG格式從什麼地方與其他preg_replaced值
我需要去每個值返回到陣列和一些preg_replace函數替換字符數組值
然後設置返回值的數值爲其他值
這裏的代碼,並在這裏就是我試圖
//first piece of code
$data['images'] = array();
foreach ($single['PictureURL'] as $ispec) {
$data['images'][] = $ispec;
$ispec = preg_replace('/\$_[0-9]+.JPG\b/i', '$_10.JPG', $ispec);
$file = 'C:\wamp64\www\mz\images1.txt';
file_put_contents ($file, $ispec, FILE_APPEND);
//images1.txt shows all images returned fine with modified strings
}
//second piece of code
$product->imageUrl = $data['images'][0];
unset($data['images'][0]);
$product->subImageUrl = $data['images'];
$file = 'C:\wamp64\www\mz\images3.txt';
file_put_contents ($file, $data['images'], FILE_APPEND);
//images3.txt shows all the images returned but without being modified?? WHY??!
第一塊的C Ode正在研究所有的價值,並且替換工作得很好。
第二塊代碼是我的問題,它返回舊的沒有修改圖像的價值觀,我不
我需要修改的圖像被寫入 之前「$產品 - > imageUrl & $ product-> subImageUrl'
感謝隊友,是在邊緣開始打破東西:d –