page= 두번 나오지 않도록 해결
This commit is contained in:
@ -260,11 +260,11 @@ while ($entry = $tmp->read()) {
|
|||||||
}
|
}
|
||||||
@ksort($amenu);
|
@ksort($amenu);
|
||||||
|
|
||||||
$qstr = '';
|
$arr_query = array();
|
||||||
if (isset($sst)) $qstr .= '&sst='.$sst;
|
if (isset($sst)) $arr_query[] = 'sst='.$sst;
|
||||||
if (isset($sod)) $qstr .= '&sod='.$sod;
|
if (isset($sod)) $arr_query[] = 'sod='.$sod;
|
||||||
if (isset($sfl)) $qstr .= '&sfl='.$sfl;
|
if (isset($sfl)) $arr_query[] = 'sfl='.$sfl;
|
||||||
if (isset($stx)) $qstr .= '&stx='.$stx;
|
if (isset($stx)) $arr_query[] = 'stx='.$stx;
|
||||||
if (isset($page)) $qstr .= '&page='.$page;
|
if (isset($page)) $arr_query[] = 'page='.$page;
|
||||||
//$qstr = 'sst=$sst&sod=$sod&sfl=$sfl&stx=$stx&page=$page';
|
$qstr = implode("&", $arr_query);
|
||||||
?>
|
?>
|
||||||
@ -18,7 +18,7 @@ function get_microtime()
|
|||||||
// 현재페이지, 총페이지수, 한페이지에 보여줄 행, URL
|
// 현재페이지, 총페이지수, 한페이지에 보여줄 행, URL
|
||||||
function get_paging($write_pages, $cur_page, $total_page, $url, $add="")
|
function get_paging($write_pages, $cur_page, $total_page, $url, $add="")
|
||||||
{
|
{
|
||||||
$url = preg_replace('#(&|&)?page\=[0-9]+#', '', $url);
|
$url = preg_replace('#&page=[0-9]*(&page=)$#', '$1', $url);
|
||||||
|
|
||||||
$str = '';
|
$str = '';
|
||||||
if ($cur_page > 1) {
|
if ($cur_page > 1) {
|
||||||
@ -748,7 +748,15 @@ function subject_sort_link($col, $query_string='', $flag='asc')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return '<a href="'.$_SERVER['PHP_SELF'].'?'.$query_string.'&'.$q1.'&'.$q2.'&sfl='.$sfl.'&stx='.$stx.'&page='.$page.'">';
|
$arr_query = array();
|
||||||
|
$arr_query[] = $q1;
|
||||||
|
$arr_query[] = $q2;
|
||||||
|
$arr_query[] = 'sfl='.$sfl;
|
||||||
|
$arr_query[] = 'stx='.$stx;
|
||||||
|
$arr_query[] = 'page='.$page;
|
||||||
|
$qstr = implode("&", $arr_query);
|
||||||
|
|
||||||
|
return "<a href=\"{$_SERVER['PHP_SELF']}?{$qstr}\">";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
30
test.php
30
test.php
@ -1,24 +1,8 @@
|
|||||||
<!doctype html>
|
<?
|
||||||
<html lang="ko">
|
$qstr1 = "&stx=ddd&page=123";
|
||||||
<head>
|
$qstr2 = "&stx=ddd&page=123&";
|
||||||
<title>title</title>
|
$qstr3 = "&stx=ddd&page=&";
|
||||||
<meta charset="utf-8">
|
$qstr3 = "&stx=ddd&page=x&";
|
||||||
<script src="js/jquery-1.8.3.min.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<p>이 문자열에서 부분을 치환합니다.</p>
|
echo preg_replace('#(&|&)?page\=[^&]*#', '', $qstr3);
|
||||||
|
?>
|
||||||
<a href="#" title="치환">치환하기</a>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
$(function(){
|
|
||||||
$('a').click(function(){
|
|
||||||
$('p').text("치환");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Reference in New Issue
Block a user