Home  >  Article  >  Backend Development  >  How to display video in php and escape other codes

How to display video in php and escape other codes

WBOY
WBOYOriginal
2016-09-08 08:43:591451browse

I create a textarea tag on the front page to submit content. Users can enter any content here, but I want to perform special processing on the following three types. What should I do?

  1. Video: You can insert Youku’s video code and display the video in the front desk after reading it from the database.

  2. Picture: After entering the picture address, the picture can be displayed

  3. Link: Enter an address and the link will be displayed

Other symbols, codes, etc. are escaped. For example,

<script>alert('hello')</script>, <p style="color:#f00">hello world</p>, etc. are all output as they are on the page.

When re-editing, the content previously entered by the user is still displayed, not the converted content.

The backend language is php, how to write php, thank you!

Reply content:

I create a

textarea tag on the front page to submit content. Users can enter any content here, but I want to perform special processing on the following three types. What should I do?

    Video: You can insert Youku’s video code and display the video in the front desk after reading it from the database.
  1. Picture: After entering the picture address, the picture can be displayed
  2. Link: Enter an address and the link will be displayed
  3. Other symbols, codes, etc. are escaped. For example,
<script>alert('hello')</script>

, <p style="color:#f00">hello world</p>, etc. are all output as they are on the page. When re-editing, the content previously entered by the user is still displayed, not the converted content.

The backend language is php, how to write php, thank you!

If your level is low, you can only think of regular rules...

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn