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 –