page= 두번 나오지 않도록 해결
This commit is contained in:
30
test.php
30
test.php
@ -1,24 +1,8 @@
|
||||
<!doctype html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<title>title</title>
|
||||
<meta charset="utf-8">
|
||||
<script src="js/jquery-1.8.3.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<?
|
||||
$qstr1 = "&stx=ddd&page=123";
|
||||
$qstr2 = "&stx=ddd&page=123&";
|
||||
$qstr3 = "&stx=ddd&page=&";
|
||||
$qstr3 = "&stx=ddd&page=x&";
|
||||
|
||||
<p>이 문자열에서 부분을 치환합니다.</p>
|
||||
|
||||
<a href="#" title="치환">치환하기</a>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
$('a').click(function(){
|
||||
$('p').text("치환");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
echo preg_replace('#(&|&)?page\=[^&]*#', '', $qstr3);
|
||||
?>
|
||||
Reference in New Issue
Block a user