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,530  
$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 167
번호 제   목 글쓴이 날짜 조회
107 [그누소스] 숫자변경 Morning 02-22 3356
106 [소스변경] 온라인문의 (1) Morning 02-22 6692
105 [소스문법] 일정한 부분을 다른 것으로 치환하는 방법 (9) Morning 02-22 6531
104 [소스문법] div, table (2) Morning 01-20 5521
103 [소스변경] 블로그단축주소를 위한 소스변경 Morning 02-19 4486
102 [그누소스] 네비게이션 (1) Morning 02-17 4549
101 [그누소스] 홈관리메뉴 (1) Morning 02-16 3348
100 [소스변경] 펼침카테고리 사용시 Morning 02-15 3893
99 [그누스킨] morning_webzin3 Morning 02-13 4001
98 [그누소스] 블로그 최신글 Morning 02-12 4265
97 [소스변경] 까페를 위한 소스변경사항 Morning 02-07 4184
96 [홈준비] 웹진과제 Morning 02-06 5148
95 [소스문법] dq_thumb_engine2를 쓴 최신글스킨에서 썸네일 안… (1) Morning 02-04 5552
94 [그누소스] 생성한 썸네일을 스킨에서 몽땅 삭제하기 Morning 02-04 3457
93 [그누소스] 썸네일 생성- 않으면서 빠르게 출력 (2) Morning 02-04 3717
 1  2  3  4  5  6  7  8  9  10    

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