In PHP do i need to escape backslashes?

后端 未结 6 1043
予麋鹿
予麋鹿 2020-11-30 10:09

I think this may be a stupid question, but I am quite confused whether I need to escape backslash in PHP.

echo \'Application\\Models\\User\'; prints Applicat         


        
6条回答
  •  情话喂你
    2020-11-30 10:51

    If it is to be used in an HTML page, then you might as well use code \ to represent a backslash, like so:

    echo 'Application\Models\User';
    

    It will print:

    Application\Models\User

提交回复
热议问题