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

Hen*_*wan 1 php wordpress

我构建了一个功能主题选项wordpress.

但是我现在收到以下错误,我做错了什么?

  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')";
Run Code Online (Sandbox Code Playgroud)

致命错误:[]运算符不支持字符串

我错过了什么代码?

Tha*_*vam 8

您可能已将此变量$w_custom_font1_src用作string程序中的其他位置.

所以现在重新初始化为 array

 $w_custom_font1_src =  array();
Run Code Online (Sandbox Code Playgroud)