임 퀴즈 시스템을 개발 PHP에서 대체 ..문자열</p> <p>하자 내가이 문자열을 가지고 있다고 ..
$my_string = "The language i use is [ans]php[/ans]";
출력은 다음과 같습니다
내가 사용하는 언어는 [입력 이름 = 'ans'id = 'ans'/] // 방식으로 텍스트 상자
나는 preg_replace 함수를 사용하지만 행운은 사용하지 않습니다.
내 코드 :
$string = 'The quick [j]brown[/j] fox jumped over the lazy dog.';
$patterns = array();
$patterns[0] = '!\[j\]]';
$patterns[1] = '/brown/';
$patterns[2] = '\[/j\]!';
$replacements = array();
$replacements[0] = '';
$replacements[1] = '<input type="text" name="j_1" id="j_1" />';
$replacements[2] = '';
echo preg_replace($patterns, $replacements, $string);
출력했다 :
The quick []<input type="text" name="j_1" id="j_1" /> [/] fox jumped over the lazy dog.
기대 : 너희들이 도울 수 있다면
The quick <input type="text" name="j_1" id="j_1" /> fox jumped over the lazy dog.
정말 감사 ..
감사
정말로 출력하고 싶습니까? – alexn
무엇이 잘못되었는지 알아 내려고 코드를 게시 해주세요 ... – ircmaxell
출력이 달라졌습니다 ... – zacual