M
M
ms23452015-01-03 14:18:15
Yii
ms2345, 2015-01-03 14:18:15

How to use DOMDocument in yii2?

Hello.
I wanted to use the DOMDocument class:
$dom = new DOMDocument();
As a result, I received an error that the class was not found.
Class 'app\controllers\DOMDocument' not found
Can you please tell me how it could be connected and used in yii2?
Version: 2.0.6

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dave, 2015-01-03
@ms2345

Solution:
1) Either add to DOMDocument import,

use ...
use DOMDocument;

class Controller ....

2) Or, when called, refer to it as a global class:
$dom = new \DOMDocument();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question