답변 1개
http://php.net/manual/kr/function.str-replace.php">http://php.net/manual/kr/function.str-replace.php
위 함수를 사용하시면 됩니다.
http://php.net/manual/kr/language.pseudo-types.php#language.types.mixed" class="type mixed" style="border-bottom-width: 1px; border-bottom-style: solid; text-decoration: none; color: rgb(51, 102, 153);">mixed str_replace ( http://php.net/manual/kr/language.pseudo-types.php#language.types.mixed" class="type mixed" style="border-bottom-width: 1px; border-bottom-style: solid; text-decoration: none; color: rgb(51, 102, 153);">mixed $search , http://php.net/manual/kr/language.pseudo-types.php#language.types.mixed" class="type mixed" style="border-bottom-width: 1px; border-bottom-style: solid; text-decoration: none; color: rgb(51, 102, 153);">mixed $replace , http://php.net/manual/kr/language.pseudo-types.php#language.types.mixed" class="type mixed" style="border-bottom-width: 1px; border-bottom-style: solid; text-decoration: none; color: rgb(51, 102, 153);">mixed $subject [, int &$count ] )
subject에서 발견한 모든 search를 주어진 replace 값으로 치환한 문자열이나 배열을 반환합니다.
혹시 사용법에 고민을 하실까봐 간단하게 설명하자면
만약
</p><p><?</p><p>$co_id = '이걸로 변경';</p><p>$abc = "<span style="font-size: 10pt; line-height: 1.5;">[co_id]</span><span style="font-size: 10pt; line-height: 1.5;">"; //co_id 라는 곳에 내용을 불러와서 해당 변수로 넣는다고 하면</span></p><p> </p><p>//str_replace(찾을값, 변경할값, 변경할내용이들어있는 변수);</p><p> </p><p>//이제 변경을 하자면 </p><p>$cba = str_replace('[co_id]', '{$co_id}', '{$abc}');</p><p>?></p><p><span style="font-size: 10pt; line-height: 1.5;">
이렇게 하면 실제로 $abc변수에 있는 [co_id]가 실제 $co_id 값이 들어가게됩니다.
너무 주저리주저리 적어서 이해가 안가실수 있지만, 코드는 막코딩 이라서 작동 안할수도있습니다..
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인