Home > php教程 > php手册 > php警告Creating default object from empty value 问题的解决方法

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

WBOY
Release: 2016-06-06 20:23:34
Original
3397 people have browsed it

PHP 提示 Creating default object from empty value 的问题,一般是由于PHP版升级的原因,PHP 5.4 以上的版本一般会报这个错误

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

复制代码 代码如下:

$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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template