我想我必须逃避{
因为我收到错误
所以这是
function aq_field_icon_picker($field_id, $block_id, $icon, $default = '') {
$output = '<div class="icon-picker" data-pickerid="fa" data-iconsets='{"fa":"Pick FontAwesome"}'>';
return $output;
}
我怎样逃避{}?
答案 0 :(得分:0)
你需要逃避&#39; {}
周围的字符function aq_field_icon_picker($field_id, $block_id, $icon, $default = '') {
$output = '<div class="icon-picker" data-pickerid="fa" data-iconsets=\'{"fa":"Pick FontAwesome"}\'>';
return $output;
}
http://php.net/manual/en/regexp.reference.escape.php
或更改&#39;到&#34;
function aq_field_icon_picker($field_id, $block_id, $icon, $default = '') {
$output = '<div class="icon-picker" data-pickerid="fa" data-iconsets="{"fa":"Pick FontAwesome"}">';
return $output;
}
答案 1 :(得分:0)
如果您尝试使用双引号而不是
,则使用单引号结束字符串$output = '<div class="icon-picker" data-pickerid="fa" data-iconsets="{"fa":"Pick FontAwesome"}"">';
答案 2 :(得分:0)
的单引号
data-iconsets='{"fa"
结束字符串,PHP不知道以下是什么。