How to resolve the problem of php warning Creating default object from empty value
This article focuses on "how to solve the problem of php warning Creating default object from empty value". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to solve the problem of php warning Creating default object from empty value.
The solution is to find the location where the error is reported and see which variable is used directly without initialization, and instantiate the variable to an empty class first. Such as:
The copy code is as follows:
$ct = new stdClass ()
Modify the corresponding code of the file, such as:
The copy code is as follows:
If (! Isset ($themes [$current_theme])) {
Delete_option ('current_theme')
$current_theme = get_current_theme ()
}
$ct = new stdClass ()
$ct- > name = $current_theme
Problem solved.
At this point, I believe you have a deeper understanding of "how to solve the php warning Creating default object from empty value problem". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!