angle bracket mysql php

This question already has an answer here:

  • php echoing angle brackets 4 answers

  • The output of from_addr will be there if you are receiving results from your query.

    Take a look at this example:

    $string = '<hello world>';
    echo $string;
    echo htmlspecialchars('<hello world>');
    

    Whereas, echo $string will show in the source code, but is being treated as a tag, and therefore not display "on screen".

    Using the htmlspecialchars() will change < > to &lt; &gt; &lt; &gt; which will show "on screen".

    It appears that you are using this field for email, so I would NOT recommend saving to the database with htmlspecialchars , as you want the emails to send properly.

    If the above didn't answer your question fully, and you wish to query the database for an email rather than the "send name", I would recommend using LIKE :

    SELECT * FROM `msgs` WHERE `from_addr` LIKE '<%INSERT_EMAIL_ADDRESS%>'.
    

    Hope this helps.

    链接地址: http://www.djcxy.com/p/21450.html

    上一篇: mysql中的desc表示Null是No,但默认为NULL?

    下一篇: 角度支架MySQL的PHP