08/09/23 22:38:30 JwvtqXNH
■index.php
<?php
if($mode=="js") {
header("Content-Type:text/javascript");
echo <<<EOM
window.onload = test;
function test() {
for(i=0;i<5;i++) {
alert("test");
}
}
EOM;
} else {
echo <<<EOM
<html><head>
<script type="text/javascript" src="./index.php?mode=js"></script>
</head><body>...</body></html>
EOM;
}
?>
このように書いたときにスクリプトの中に<や>が入ると(※8行目)上手く動作しないのですが
何か良い改善策はないでしょうか?