如何在PHP中的字符串中使用\? [重复]

This question already has an answer here:

i want to use \ in a string,like

public function log($logLevel,$msg){
    $class=substr(__CLASS__,strpos(__CLASS__,'\'));
    $filPath=$class."-log.txt";
    file_put_contents($filPath,$logLevel." : ".$msg.PHP_EOL,FILE_APPEND);
}

But this is giving me error. Can anyone help me out?

</div>

Backslashes in PHP are interpreted as the start of an escape character. Your sequence, '\', starts a string and escapes the second ' instead of using it to close the string. Use two backslashes (\\) to escape the first backslash instead of escaping your quote.

See Escape sequences and the documentation for strings.