私は次のように使用しstr_replace
ています:
<html>
<head>
</head>
<body>
<script type="text/php">
$new_str = str_replace( '[[str_to_replace]]' , $GLOBALS['html'] , $original_str );
</script>
<div class="wrapper">[[str_to_replace]]</div>
<?php
// multiple includes
// lots and lots of code
//PHP code to calculate HTML code
//value of $html depends on data calculated after div.wrapper is drawn
$GLOBALS['html'] = '<input type="text" />';
?>
</body>
</html>
script
ドキュメントがHTMLドキュメントとしてライブラリに渡されるため、PHPコードをタグでラップする必要があります。ライブラリにはスクリプトタグ内でPHPコードを実行する機能がありますが、この場合は奇妙に機能しています。
私が期待していること:
[[str_to_replace]]
HTML入力フィールドになる必要があります。
私が得ているもの:
[[str_to_replace]]
リテラル文字列になります<input type="text" />
。
2番目の結果を取得するにはどうすればよいですか?