Strict Standards: Non-static method DOMDocument::load() should not be called statically - PHP andrey суббота, 12 июля 2014 г. No Comment

In PHP recently I faced this issue. When I tried to use my xml file using php's document load() function.

Problem
$dom = DOMDocument::load('myXml.xml');
It works perfectly. But I throws error
Strict Standards: Non-static method DOMDocument::load() should not be called statically
Solution
The reason why it's happening is because I called a load() method in the DOMDocument class in which is not static.

 Instead of calling it with :: We need to call it with ->

I found PHP document about the usage of DOMDocument load() method.
$doc = new DOMDocument();
$doc->load('myXml.xml');
Now the error is gone...!!!

Have any doubt feel free to comment here!


In PHP recently I faced this issue. When I tried to use my xml file using php's document load() function.

Problem
$dom = DOMDocument::load('myXml.xml');
It works perfectly. But I throws error
Strict Standards: Non-static method DOMDocument::load() should not be called statically
Solution
The reason why it's happening is because I called a load() method in the DOMDocument class in which is not static.

 Instead of calling it with :: We need to call it with ->

I found PHP document about the usage of DOMDocument load() method.
$doc = new DOMDocument();
$doc->load('myXml.xml');
Now the error is gone...!!!

Have any doubt feel free to comment here!


by Jillur Rahman

Jillur Rahman is a Web designers. He enjoys to make blogger templates. He always try to make modern and 3D looking Templates. You can by his templates from Themeforest.

Follow him @ Twitter | Facebook | Google Plus

No Comment