<?php
function h($s){
return htmlspecialchars($s, ENT_QUOTES, 'utf-8');
}
「htmlspecialchars」はHTML用のエスケープ関数とのこと。
上記いついては、ENT_QUOTESで「'」と「"」を、ともに変換している。
utf-8は、もちろん文字コードUTF-8のこと。
つまり、ここでは引数$sに対して、「'」および「"」を変換し、UTF-8に固定しているという形になる。
Go to list of users who liked
More than 5 years have passed since last update.
<?php
function h($s){
return htmlspecialchars($s, ENT_QUOTES, 'utf-8');
}
「htmlspecialchars」はHTML用のエスケープ関数とのこと。
上記いついては、ENT_QUOTESで「'」と「"」を、ともに変換している。
utf-8は、もちろん文字コードUTF-8のこと。
つまり、ここでは引数$sに対して、「'」および「"」を変換し、UTF-8に固定しているという形になる。
Register as a new user and use Qiita more conveniently
Go to list of users who liked