PHP Echo - Escaping quotes

后端 未结 4 1085
不思量自难忘°
不思量自难忘° 2021-01-25 22:46

I was programming something in PHP but since I\'m a newbie I got stuck.

I have no clue how should I escape quotes on the following line. Moreover, I think the PHP tags i

4条回答
  •  無奈伤痛
    2021-01-25 23:37

    Escape with a backslash, use "." for concatenation.

    $row = array();
    $row['ID'] = 1;
    
    echo '';
    

    Output

    
    

    Also make sure to escape any content you're going to use in Javascript or HTML. For an ID, you might just cast as an integer:

    echo '';
    

    Strings'll be more important to escape.

提交回复
热议问题