Khi nào tôi nên sử dụng htmlspecialchars?

Trong bài hướng dẫn điều khiển thanh trượt HTML5, chúng ta cần một biểu mẫu để kiểm tra điều khiển. Cách đơn giản để xuất nội dung đã đăng trong biểu mẫu là thực hiện…

<a href="https://www.geeksforgeeks.org">GeeksforGeeks</a>
9

trong đó "xếp hạng" là tên của trường biểu mẫu. Cái này sai

You should never use code of that pattern in production code.   That code means that whatever the user inputs in the form will be output directly on your site.  A malicious user can input some HTML and Javascript code (including the