php警告Creating default object from empty value 問題的解決方法
更新時間:2014年04月02日 10:08:26 作者:
PHP 提示 Creating default object from empty value 的問題,一般是由于PHP版升級的原因,PHP 5.4 以上的版本一般會報這個錯誤
解決方法是找到報錯的位置然后看哪個變量是沒有初始化而直接使用的,將這個變量先實例化一個空類。如:
復(fù)制代碼 代碼如下:
$ct = new stdClass();
修改文件相應(yīng)代碼,如:
復(fù)制代碼 代碼如下:
if ( ! isset( $themes[$current_theme] ) ) {
delete_option( 'current_theme' );
$current_theme = get_current_theme();
}
$ct = new stdClass(); <!--添加這行-->
$ct->name = $current_theme;
delete_option( 'current_theme' );
$current_theme = get_current_theme();
}
$ct = new stdClass(); <!--添加這行-->
$ct->name = $current_theme;
問題解決。
您可能感興趣的文章:
相關(guān)文章
學(xué)習(xí)php設(shè)計模式 php實現(xiàn)工廠模式(factory)
這篇文章主要介紹了php設(shè)計模式中的工廠模式,使用php實現(xiàn)工廠模式,感興趣的小伙伴們可以參考一下2015-12-12一些PHP Coding Tips(php小技巧)[2011/04/02最后更新]
以下是一些PHP Coding Tips. 當然, 這些Tips并不一定僅僅局限于PHP.大家有什么好的心得, 歡迎直接回復(fù)本文與更多的人分享.. 謝謝2011-05-05PHP表單驗證的3個函數(shù)ISSET()、empty()、is_numeric()的使用方法
PHP表單驗證的3個函數(shù)ISSET()、empty()、is_numeric()的使用方法分享,學(xué)習(xí)php的朋友可以參考下。2011-08-08php表設(shè)計實現(xiàn)短視頻評論區(qū)完整功能
這篇文章主要為大家介紹了php表設(shè)計實現(xiàn)短視頻評論區(qū)完整功能示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-07-07