<!DOCTYPE html>
<html>
<body>
<?php
$str = 'I love "PHP".';
echo htmlspecialchars($str, ENT_QUOTES); // 转换双引号和单引号
?>
</body>
</html>