2026 년 4 월

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

 
그누스킨 그누소스 소스변경 소스문법 홈준비 기타
 
작성일 : 10-02-22 18:00
[소스문법] 일정한 부분을 다른 것으로 치환하는 방법
 글쓴이 : Morning (211.♡.235.179)
조회 : 6,531  
$match[4][$k] = str_replace("`../`", 'http://sir.co.kr/', $match[4][$k]);

"`,../`"부분을 ' '으로 치환.
주님과 함께 모닝커피를

Morning 10-02-22 18:09
 211.♡.235.179  
substr_replace 문자열의 일부를 치환한다.
str_replace 발견한 모든 검색 문자열을 치환 문자열로 교체합니다. 
strip_tags 문자열에서 HTML과 PHP 태그를 제거합니다.
Morning 10-02-22 18:09
 211.♡.235.179  
for ($i=0; $i<count($array); $i++) {
 
위와 같은 for 루프문들이 쓰이는 것을 곧잘 볼 수 있습니다.
PHP의 for 루프문, 두번째 인자의 함수는 매 루프마다 불려지기 때문에
배열이 클수록 함수를 부르는데 걸리는 시간만으로도 실행 시간을 상당히 뺏기게 됩니다.
이는 다음과 같이 바꿔주는 것이 좋습니다.
 
예1) for ($i=0, $cnt=count($array); $i<$cnt; $i++) {
 
예2)
$cnt = count($array);
for ($i=0; $i<$cnt; $i++) {
이 방법만으로도 엄청난 성능 개선을 가져왔다는 예도 있습니다. 배열이 무척 컸나보네요^^;
추가: 실제로 저의 경우에도, 엄청나지는 않았지만 꽤 괜찮은 성능개선을 맛봤었답니다 :)
Morning 10-02-22 19:12
 211.♡.235.179  
$stx = preg_replace("/<!--/", "", $stx);

        // 제목과 내용에서 특정 단어를 없애버립니다.
        $src_char = array("홍길동", "test@gmail.com");
        $dst_char = array("아무개", "nobody@gmail.com");
        $wr_subject = str_replace($src_char, $dst_char, $wr_subject);
Morning 10-02-22 19:23
 211.♡.235.179  
$string = preg_replace("/<IMG height=([0-9]+) src='file([^\>]*) width=([0-9]+) border=0>/", "", $string);
$a = "<IMG height=361 src='file:///C:/DOCUME~1/이은찬/LOCALS~1/Temp/Hnc/BinData/EMB0000086c0b42.JPG' width=518 border=0>";
$b = "file:///C:/DOCUME~1/이은찬/LOCALS~1/Temp/Hnc/BinData/";

$c = str_replace($b,"새 경로",$a);
Morning 10-02-22 19:41
 211.♡.235.179  
str_replace("미디어인뉴스", "코리아닷미", $list[$i]['subject'])

위에것대신~

preg_replace("/(미더이인뉴스|일본)/", "코리아닷미", $list[$i]['subject'])

필터링 할것들이 더 있다면

미더이인뉴스|일본 <- 이부분을 수정

미더이인뉴스|일본|필터링1|필터링2|필터링3
Morning 10-02-22 19:52
 211.♡.235.179  
$sql = " update $g4[ssssss_table]
                set wr_subject = '".addslashes($bbs['wr_subject'])."',
                    wr_content = '".addslashes($bbs['wr_content'])."',
                                where bo_table = '$bo_table' and wr_id = '$bbs[wr_id]' ";
    sql_query($sql);
Morning 10-02-22 19:56
 211.♡.235.179  
$url_temp=str_replace("%3A",":",str_replace("%2F","/",rawurlencode($url)));
Morning 10-02-22 19:59
 211.♡.235.179  
$e_text = array("(",")"); //괄호 표시
  $list[$i][comment_k] = str_replace($e_text, "", $list[$i][comment_cnt]); //괄호 표시 변환으로 삭제
Morning 10-02-22 21:15
 211.♡.235.179  
$write_pages = preg_replace("/<b>([0-9]*)<\/b>/", "<b><font style=\"font-family:돋움; font-size:9pt; color:orange;\">$1</font></b>", $write_pages);
 
 

Total 37
번호 제   목 글쓴이 날짜 조회
37 [소스문법] 심볼릭링크없이, 두개의 그누보드에서 data폴… Morning 07-19 9615
36 [소스문법] 스타일이용하여 라운딩만들기 Morning 03-06 5605
35 [소스문법] 리다이렉트 (3) Morning 02-27 6984
34 [소스문법] 보더 입력방법 Morning 03-12 5632
33 [소스문법] 일정한 부분을 다른 것으로 치환하는 방법 (9) Morning 02-22 6532
32 [소스문법] div, table (2) Morning 01-20 5522
31 [소스문법] dq_thumb_engine2를 쓴 최신글스킨에서 썸네일 안… (1) Morning 02-04 5553
30 [소스문법] include() (5) Morning 02-03 7101
29 [소스문법] 제어 구조의 대체 문법 Morning 02-03 5573
28 [소스문법] elseif Morning 02-03 5489
27 [소스문법] else Morning 02-03 5535
26 [소스문법] if (2) Morning 02-03 5989
25 [소스문법] for (1) Morning 02-03 5438
24 [소스문법] 흐르는 글 Morning 01-31 5355
23 [소스문법] 보더를 이용해서 box 만들기 Morning 01-26 5671
 1  2  3  

Therefore, holy brothers, who share in the heavenly calling,
fix your thoughts on Jesus, the apostle and high priest whom we confess.
Let us fix our eyes on Jesus, the author and perfecter of our faith,
who for the joy set before him endured the cross, scorning its shame,
and sat down at the right hand of the throne of God