doulu4413 2016-12-06 16:54
浏览 247
已采纳

Php7.1致命错误:字符串不支持[]运算符[重复]

This question already has an answer here:

I built a some function theme option wordpress.

But I am receiving the following error now, what am I doing wrong?

  if(isset($thm_options['custom_font1_eot']))
    $w_custom_font1_src[] = "url('{$thm_options['custom_font1_eot']['url']}?#iefix') format('embedded-opentype')";

  if(isset($thm_options['custom_font1_woff']))   
    $w_custom_font1_src[] = "url('{$thm_options['custom_font1_woff']['url']}') format('woff')";

  if(isset($thm_options['custom_font1_ttf']))
    $w_custom_font1_src[] = "url('{$thm_options['custom_font1_ttf']['url']}') format('truetype')";

Fatal error: [] operator not supported for strings in

Anything I missed code?

</div>
  • 写回答

1条回答 默认 最新

  • duanji9677 2016-12-06 17:01
    关注

    You may have used this variable $w_custom_font1_src as a string somewhere else in the program.

    So now reinitialize as an array

     $w_custom_font1_src =  array();
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?