您将看到下面的代码,我正在尝试基于变量字符串$value[2]['got_error_here']
使用自定义函数名称。假设变量的内容为MyFunction
。错误显示Parse error: syntax error, unexpected 'got_error_here' (T_STRING)
。该如何解决?
查看
{!! is_array($value[2]) ? '<td><a onclick="{{ $value[2]['got_error_here'] }}"><b>Test</b></a></td>' : '<td>Test2</td>' !!}
数组内容
答案 0 :(得分:2)
将代码更改为
{!! is_array($value[2]) ? '<td><a onclick="' . $value[2]['got_error_here'] . '"><b>Test</b></a></td>' : '<td>Test2</td>' !!}