Backslash in PHP — what does it mean?

前端 未结 3 1861
广开言路
广开言路 2020-11-30 05:46

I just saw the use of a backslash in a reference to a PHP object and was curious about it (I have never seen this before). What does it mean?

$mail = new Sen         


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-30 06:23

    This is syntax for namespaces. You can read more about namespaces at PHP documentation. They they require at least PHP 5.3.

    For example:

    namespace SendGrid;
    function Mail() {
        // You can access this function by using SendGrid\Mail() externally
    }
    

提交回复
热议问题