Home > Backend Development > PHP Tutorial > php警告Creating default object from empty value 问题的解决方法_php技巧

php警告Creating default object from empty value 问题的解决方法_php技巧

WBOY
Release: 2016-05-17 08:46:29
Original
1278 people have browsed it

解决方法是找到报错的位置然后看哪个变量是没有初始化而直接使用的,将这个变量先实例化一个空类。如:

复制代码 代码如下:
$ct = new stdClass();

修改文件相应代码,如:
复制代码 代码如下:
if ( ! isset( $themes[$current_theme] ) ) {
 delete_option( 'current_theme' );
 $current_theme = get_current_theme();
}
$ct = new stdClass();
$ct->name = $current_theme;

问题解决。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template