single quote inside double quote in php

前端 未结 3 772
忘掉有多难
忘掉有多难 2021-01-14 10:27

In the project,the above code need to be put into String(see 2nd snippet). However,

相关标签:
3条回答
  • 2021-01-14 10:51

    Alternatively

    $string = '<input id="myID" onClick="CheckAll(\'A\',\'B\');" />';
    
    0 讨论(0)
  • 2021-01-14 10:58
    $string ="<input id='myID' onClick=\"CheckAll('A','B');\" />"
    

    add escaping slashes

    0 讨论(0)
  • 2021-01-14 10:59

    You can use backslash:

    $string ="<input id=\"myID\" onClick=\"CheckAll('A','B');\" />"
    
    0 讨论(0)
提交回复
热议问题