对不起,如果我的问题很愚蠢,请有人帮我解决这个问题。如何更改preg_match PHP中的整数值?
我有串状
$str_value = "http://99.99.99.99/var/test/src/158-of-box.html/9/";
这$ str_value是动态的,它会改变每一页。现在我需要在该字符串作为10.整数加1,以取代图9和替换
例如如果$str_value = "http://99.99.99.99/var/test/src/158-of-box.html/251/"
然后输出应该是
http://99.99.99.99/var/test/src/158-of-box.html/252/
我试图使用的preg_match更换但即时得到错请pleasesone帮我
$str = preg_replace('/[\/\d+\/]/', '10',$str_value);
$str = preg_replace('/[\/\d+\/]/', '[\/\d+\/]+1',$str_value);
谢谢@calimero :) –
刚刚添加了一些解释来说明我对代码所做的更改。你最欢迎:) – Calimero