Php7.1 致命错误:字符串不支持 [] 运算符 [英] Php7.1 Fatal error: [] operator not supported for strings

查看:27
本文介绍了Php7.1 致命错误:字符串不支持 [] 运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

 if(isset($thm_options['custom_font1_eot']))$w_custom_font1_src[] = "url('{$thm_options['custom_font1_eot']['url']}?#iefix') 格式('embedded-opentype')";if(isset($thm_options['custom_font1_woff']))$w_custom_font1_src[] = "url('{$thm_options['custom_font1_woff']['url']}') 格式('woff')";if(isset($thm_options['custom_font1_ttf']))$w_custom_font1_src[] = "url('{$thm_options['custom_font1_ttf']['url']}') 格式('truetype')";

<块引用>

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

我错过了什么代码吗?

解决方案

您可能在程序的其他地方使用了这个变量 $w_custom_font1_src 作为 string.>

所以现在重新初始化为array

 $w_custom_font1_src = array();

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?

解决方案

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();

这篇关于Php7.1 致命错误:字符串不支持 [] 运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆