Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
873 views
in Technique[技术] by (71.8m points)

string - PHP quotes inside quotes

Is it possible to put quotes inside quotes?

If so how?

Here is my code:

<?php

    echo '<span onclick="$(this).addClass('selected');"> </span>';

?>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

According to php.net

To specify a literal single quote, escape it with a backslash (). 

It means you could have:

<?php
  echo '<span onclick="$(this).addClass('selected');"> </span>';
?>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...