在表单中输入数据时出现此错误
分析错误:语法错误,中出现意外的T\\u CONSTANT\\u ENCAPSED\\u字符串
\\功能。php第77行
return \'<span class="vwbx">Views</span>\'\'<span class="vwbx">$count.</span>\';
====整个函数====
function getPostViews($postID){
$count_key = \'post_views_count\';
$count = get_post_meta($postID, $count_key, true);
if($count==\'\'){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, \'0\');
return "0 View";
}
return $count. \'<span class="vwbx">Views</span>\'\'<span class="vwbx">views</span>\';
}
最合适的回答,由SO网友:Stephen Harris 整理而成
问题是有两个字符串实际上并没有被附加在一起。
尝试替换
return $count. \'<span class="vwbx">Views</span>\'\'<span class="vwbx">views</span>\';
使用
return $count. \'<span class="vwbx">Views</span>\'.\'<span class="vwbx">views</span>\';
(请注意中间添加的句点)。
或者,从中间删除两个引号:
return $count. \'<span class="vwbx">Views</span><span class="vwbx">views</span>\';
这应该行得通:D
EDIT针对您的评论。。。我想你会想用以下内容来代替它:
return \'<span class="vwbx">Views</span><span class="bxarw"></span><span class="CntBx">\'.$count.\'</span>\';