php출력 문의 채택완료
https://sir.kr/pg_tip/16019" target="_blank">https://sir.kr/pg_tip/16019
슈와이님 팁인데요.
저기에서 아래 코드가 출력 같은데요.
new UrlChange($search, $replace);
위 출력 코드를 아래처럼 담으려면 어떻게 해야할까요?
$aaa = "출력값"; 이런식으로요.
답변 1개
$value 를 추가 하였습니다
class UrlChange { var $matches, $i = 0, $regex = '/(?<=src=")[^"]+/' , $value="" ; function __construct($search, $replace) { preg_match_all($this->regex, $search, $matches); $this->matches = $matches[0]; $this->value=preg_replace_callback($this->regex, array($this, 'call'), $replace); } function call($m) { return $this->matches[$this->i++]; } function getData(){return $this->value;} } $bbb= new UrlChange($search, $replace); $aaa = $bbb->getData(); echo $aaa;
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인