Get the App
SLTechnology News&Howtos  ›  Development  › 

How to resolve the problem of php warning Creating default object from empty value

Shulou Source: shulou.com Published: 2022-06-03 07:50:45 11月15日 Update

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!

Tags: Code questions content variables methods learning practicality deeper location interest examples practicality practicality simplicity of operation files more friends websites channels queries Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux MySQL Microsoft OPPO Reno Huawei