这个是我写的url 切换代码 用于记录
//&pay=1&pr=50 //preg_match 用于执行正则表达式 捕获组 //$pattern=‘/(\w+)@(\w+).(com|org)/‘; $pattern=‘/(\w+)&(\w+)=(\w+)/‘; $prs=‘/&pr=(\w*)/i‘; $strr=‘[email protected]‘; $payd=‘‘; $prd=‘‘; preg_match($pattern,$urlv,$pay); preg_match($prs,$urlv,$prd); echo ‘<br />001/‘; var_dump($pay); echo ‘<br />004/‘; var_dump($prd); echo ‘<br />006/‘; var_dump(is_array($pay)&&count($pay)); echo ‘<br />007‘; var_dump(is_array($pay)&&count($pay)?$payd=$pay[3]:$payd=‘1‘); is_array($pay)&&count($pay)?$pay=$pay[3]:$pay=‘1‘; is_array($prd)&&count($prd)?$prd=$prd[1]:$prd=‘0‘; //$payd=$pay[3]; //$prd=$prsout[1]; echo ‘<br />005/‘; echo $pay.‘<br />‘.$prd.‘<br />‘; //(w+)与协议解析相关 //非捕获组 //no 007 $pattern=‘/(\w+)@(\w+).(?:com|org)/‘; $strr=‘[email protected]‘; preg_match($pattern,$strr,$match); echo ‘<br />002/‘; print_r($match); //正向前查找组 负向前查找组 ?= 和 ?! $pattern=‘/sh(?=e)(\w*)/i‘; $str="shelly sells seashells by the seashore"; preg_match($pattern,$str,$match); echo ‘<br />003/‘; print_r($match); echo ‘---www.weicot.com--------------------------------------------------------------------------------------------‘; $pay=‘1‘; $br=‘50‘; $re=‘z1‘; $id=‘&pay=‘.$pay.‘&pr=‘.$br; echo ‘<br />‘.$id ; $id=base64_encode($id); echo ‘<br />&id=‘.$id.‘&‘.$re; $id=base64_decode($id); echo ‘<br />&id=‘.$id.‘&‘.$re;
时间: 2024-10-13 16:54:59