형님들 치환이 안됩니다;
관련링크
http://치환
119회 연결
본문
src="../../data/abc.jpg"
src="../data/def.jpg"
위에서
../../ 두개일떄랑 ../ 한개일떄를 www.naver.com/ 으로 치환하려면
$a = array ('../../' , '../' );
$b= array ('www.naver.com/' , 'www.naver.com/' );
str_replace( $a , $b , $result );
요런식으로 하는게 아니었나요?
답변 1
http://php.net/manual/kr/function.str-replace.php
인자 순서가 찾을 문자, 바꿀문자, 문자열 순입니다.
아래는 배열 사용시 예제
// 결과: You should eat pizza, beer, and ice cream every day
$phrase = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables", "fiber");
$yummy = array("pizza", "beer", "ice cream");
$newphrase = str_replace($healthy, $yummy, $phrase);
답변을 작성하시기 전에 로그인 해주세요.