Is there an easy way to remove with php
PHP 文字列の任意のタイプのイベント HTML。たとえば、 submit、mouseOut、mouseOver、click、blur、focus などのイベントの場合です。次のような場合に JavaScript インジェクションを防ぐに は: たとえば、 submit、mouseOut、mouseOver、click、blur、focus などのイベントの場合です。次のような場合に、JavaScript インジェクションを防止します。
$text= 'mi secure html <div id="javascript_injection" onfocus=function(){SomeJavaScriptCode}></div> <p> Im interested in showing the resulting html </p>'
echo $text = 'mi secure html <div id="javascript_injection" > example </div> <b> Im interested in showing the resulting html </b>
私はこれを示すことにも興味があります:
'mi secure html <div id="javascript_injection" > example </div> <b> Im interested in showing the resulting html </b>
PD:HTMLで表示したい部分があるので、全文をエスケープしたり、全タグを削除したりすることはできません。Imagine you want to show a user creates html to another and want to avoid the injection of javascript