PHP: different quotes?

后端 未结 3 1253
太阳男子
太阳男子 2020-11-28 15:47

What is the difference between the quotes \" and \' ? What about `? Is there an error in using different quotes \' and \" below?

 $result = pg_query_params($         


        
3条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-28 16:38

    The difference between single and double quoted strings is well explained in the PHP manual about Strings.

    In your example, since you are using substitution variables such as $1 that mean something specific to pg_query_params and that you do not want PHP to interpret as variable names, you should use single quotes for your SQL query strings.

提交回复
热议问题