<p> </p>
<p><img src="../../../..//js/uploads/images/selva.png" alt="" /></p>
<p>we are checkng our website</p>
<p>kfoaskf</p>
<p>asldfjas</p>
<p>jasdklfk'sd</p>
<p><img src="../../../..//js/uploads/images/images.jpg" alt="" /></p>
这是我的字符串值。我需要改变这一点
<img src="../../../..//js/uploads/images/images.jpg">
来
<img src="js/uploads/images/images.jpg">
对于每个图像,我需要修改路径。 怎么做?我的字符串值每次都不同
答案 0 :(得分:2)
试试这个兄弟
$str='<p> </p>
<p><img src="../../../..//js/uploads/images/selva.png" alt="" /></p>
<p>we are checkng our website</p>
<p>kfoaskf</p>
<p>asldfjas</p>
<p>jasdklfk\'sd</p>
<p><img src="../../../..//js/uploads/images/images.jpg" alt="" /></p>';
echo str_replace("../../../..//js/uploads/images/images.jpg","/js/uploads/images/images.jpg",$str);