Trying to use PHP DateTime Class with Yii2 receiving class not found errors

前端 未结 2 973
野的像风
野的像风 2020-12-29 05:03

Hello I am trying to create my own custom helper class to use with Yii2. It is going to handle times so I\'ll be working with PHP\'s DateTime class. I have



        
2条回答
  •  暖寄归人
    2020-12-29 05:31

    Put a backslash in from of the class name to indicate it is in the global namespace:

    $time = new \DateTime('now', new \DateTimeZone('UTC'));
    

提交回复
热议问题