DomDocument

Hi

I have problem with domdocument. When I try to initialise object I get error:




 private function parseLinks($page, $html){

  $dom = new DomDocument();

  $dom->loadHTML('<?xml encoding="UTF-8">' . $html);

}






 F:\httpd\xstorm>yii example/test

 PHP Fatal Error 'yii\base\ErrorException' with message 'Class 'console\models\parser\DomDocument' not found'



I am running script in console window.

I checked if domdocument is working if I run it in a php file from cmd and it is working.

Thank you for any suggestion

Try:




...

$dom = new \DomDocument();

...



1 Like