채택완료
정규식 문의 드려요 preg_replace('/\<AND>/','<AND>', $response)
<AND> 를 & l t ; AND & g t ; 로 치환하고 싶은데 정규식을 잘 몰라서인지 아래처럼 해서는 되지 않습니다.
$response = preg_replace('/<AND>/',' & l t ; AND & g t ;', $response);
고수님들에게 해결방법 부탁드립니다. --;
답변 4개
채택된 답변
+20 포인트
2년 전
https://www.php.net/manual/en/function.htmlspecialchars
https://www.php.net/manual/en/function.htmlspecialchars-decode.php
Copy
<?php
$response = 'AND<AND>&lt;AND&gt;';
$response = htmlspecialchars_decode($response);
$response = htmlspecialchars($response);
echo $response;
?>
2년 전
Copy
$response = preg_replace('/<AND>/', '<AND>', $response);
grimm75
2년 전
감사합니다.
2년 전
htmlspecialchars()함수를 이용하시면 됩니다.
답변을 작성하려면 로그인이 필요합니다.